[intel-oneapi-mpi]: restore support for classic wrapper names (#44982)
* [intel-oneapi-mpi]: add back support for classic wrappers * spack style fixes * add error checking
This commit is contained in:
		| @@ -122,7 +122,12 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): | |||||||
|     variant( |     variant( | ||||||
|         "generic-names", |         "generic-names", | ||||||
|         default=False, |         default=False, | ||||||
|         description="Use generic names, e.g mpicc instead of mpiicc", |         description="Use generic names, e.g mpicc instead of mpiicx", | ||||||
|  |     ) | ||||||
|  |     variant( | ||||||
|  |         "classic-names", | ||||||
|  |         default=False, | ||||||
|  |         description="Use classic compiler names, e.g mpiicc instead of mpiicx", | ||||||
|     ) |     ) | ||||||
|     variant( |     variant( | ||||||
|         "external-libfabric", default=False, description="Enable external libfabric dependency" |         "external-libfabric", default=False, description="Enable external libfabric dependency" | ||||||
| @@ -130,6 +135,7 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): | |||||||
|     depends_on("libfabric", when="+external-libfabric", type=("link", "run")) |     depends_on("libfabric", when="+external-libfabric", type=("link", "run")) | ||||||
| 
 | 
 | ||||||
|     provides("mpi@:3.1") |     provides("mpi@:3.1") | ||||||
|  |     conflicts("+generic-names +classic-names") | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|     def mpiexec(self): |     def mpiexec(self): | ||||||
| @@ -150,17 +156,24 @@ def env_script_args(self): | |||||||
|         else: |         else: | ||||||
|             return () |             return () | ||||||
| 
 | 
 | ||||||
|     def setup_dependent_package(self, module, dep_spec): |     def wrapper_names(self): | ||||||
|         if "+generic-names" in self.spec: |         if "+generic-names" in self.spec: | ||||||
|             self.spec.mpicc = join_path(self.component_prefix.bin, "mpicc") |             return ["mpicc", "mpicxx", "mpif77", "mpif90", "mpifc"] | ||||||
|             self.spec.mpicxx = join_path(self.component_prefix.bin, "mpicxx") |         elif "+classic-names" in self.spec: | ||||||
|             self.spec.mpif77 = join_path(self.component_prefix.bin, "mpif77") |             return ["mpiicc", "mpiicpc", "mpiifort", "mpiifort", "mpiifort"] | ||||||
|             self.spec.mpifc = join_path(self.component_prefix.bin, "mpifc") |  | ||||||
|         else: |         else: | ||||||
|             self.spec.mpicc = join_path(self.component_prefix.bin, "mpiicx") |             return ["mpiicx", "mpiicpx", "mpiifx", "mpiifx", "mpiifx"] | ||||||
|             self.spec.mpicxx = join_path(self.component_prefix.bin, "mpiicpx") | 
 | ||||||
|             self.spec.mpif77 = join_path(self.component_prefix.bin, "mpiifx") |     def wrapper_paths(self): | ||||||
|             self.spec.mpifc = join_path(self.component_prefix.bin, "mpiifx") |         return [self.component_prefix.bin.join(name) for name in self.wrapper_names()] | ||||||
|  | 
 | ||||||
|  |     def setup_dependent_package(self, module, dep_spec): | ||||||
|  |         wrappers = self.wrapper_paths() | ||||||
|  |         self.spec.mpicc = wrappers[0] | ||||||
|  |         self.spec.mpicxx = wrappers[1] | ||||||
|  |         self.spec.mpif77 = wrappers[2] | ||||||
|  |         # no self.spec.mpif90 | ||||||
|  |         self.spec.mpifc = wrappers[4] | ||||||
| 
 | 
 | ||||||
|     def setup_dependent_build_environment(self, env, dependent_spec): |     def setup_dependent_build_environment(self, env, dependent_spec): | ||||||
|         dependent_module = dependent_spec.package.module |         dependent_module = dependent_spec.package.module | ||||||
| @@ -171,18 +184,12 @@ def setup_dependent_build_environment(self, env, dependent_spec): | |||||||
|         env.set("I_MPI_FC", dependent_module.spack_fc) |         env.set("I_MPI_FC", dependent_module.spack_fc) | ||||||
| 
 | 
 | ||||||
|         # Set compiler wrappers for dependent build stage |         # Set compiler wrappers for dependent build stage | ||||||
|         if "+generic-names" in self.spec: |         wrappers = self.wrapper_paths() | ||||||
|             env.set("MPICC", join_path(self.component_prefix.bin, "mpicc")) |         env.set("MPICC", wrappers[0]) | ||||||
|             env.set("MPICXX", join_path(self.component_prefix.bin, "mpicxx")) |         env.set("MPICXX", wrappers[1]) | ||||||
|             env.set("MPIF77", join_path(self.component_prefix.bin, "mpif77")) |         env.set("MPIF77", wrappers[2]) | ||||||
|             env.set("MPIF90", join_path(self.component_prefix.bin, "mpif90")) |         env.set("MPIF90", wrappers[3]) | ||||||
|             env.set("MPIFC", join_path(self.component_prefix.bin, "mpifc")) |         env.set("MPIFC", wrappers[4]) | ||||||
|         else: |  | ||||||
|             env.set("MPICC", join_path(self.component_prefix.bin, "mpiicx")) |  | ||||||
|             env.set("MPICXX", join_path(self.component_prefix.bin, "mpiicpx")) |  | ||||||
|             env.set("MPIF77", join_path(self.component_prefix.bin, "mpiifx")) |  | ||||||
|             env.set("MPIF90", join_path(self.component_prefix.bin, "mpiifx")) |  | ||||||
|             env.set("MPIFC", join_path(self.component_prefix.bin, "mpiifx")) |  | ||||||
| 
 | 
 | ||||||
|         env.set("I_MPI_ROOT", self.component_prefix) |         env.set("I_MPI_ROOT", self.component_prefix) | ||||||
| 
 | 
 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Robert Cohn
					Robert Cohn