zoltan: rely on MPI wrappers instead of guessing MPI libraries (#8986)
* zoltan: only add gussed MPI libs if no MPI wrappers are used - if MPI-wrappers are used for compilation, we can assume that linking works without manually specifying MPI libs (guessing may result in wrong libs, cf. #8979) - thus, only guess the NPI libs and add them explicitly if no MPI-wrappers are used - use llnl.util.filesystem.find_libraries instead of a locally defined routine to guess the MPI libs if needed (cf. #8979) * zoltan: rely on MPI-wrappers to know the required MPI libs
This commit is contained in:
		@@ -87,16 +87,11 @@ def install(self, spec, prefix):
 | 
			
		||||
 | 
			
		||||
            config_args.append('--with-mpi={0}'.format(spec['mpi'].prefix))
 | 
			
		||||
 | 
			
		||||
            mpi_libs = self.get_mpi_libs()
 | 
			
		||||
 | 
			
		||||
            # NOTE: Some external mpi installations may have empty lib
 | 
			
		||||
            # directory (e.g. bg-q). In this case we need to explicitly
 | 
			
		||||
            # pass empty library name.
 | 
			
		||||
            if mpi_libs:
 | 
			
		||||
                mpi_libs = ' -l'.join(mpi_libs)
 | 
			
		||||
                config_args.append('--with-mpi-libs=-l{0}'.format(mpi_libs))
 | 
			
		||||
            else:
 | 
			
		||||
                config_args.append('--with-mpi-libs= ')
 | 
			
		||||
            # NOTE: Zoltan assumes that it's linking against an MPI library
 | 
			
		||||
            # that can be found with '-lmpi' which isn't the case for many
 | 
			
		||||
            # MPI packages. We rely on the MPI-wrappers to automatically add
 | 
			
		||||
            # what is required for linking and thus pass an empty list of libs
 | 
			
		||||
            config_args.append('--with-mpi-libs= ')
 | 
			
		||||
 | 
			
		||||
        # NOTE: Early versions of Zoltan come packaged with a few embedded
 | 
			
		||||
        # library packages (e.g. ParMETIS, Scotch), which messes with Spack's
 | 
			
		||||
@@ -135,18 +130,3 @@ def install(self, spec, prefix):
 | 
			
		||||
    def get_config_flag(self, flag_name, flag_variant):
 | 
			
		||||
        flag_pre = 'en' if '+{0}'.format(flag_variant) in self.spec else 'dis'
 | 
			
		||||
        return '--{0}able-{1}'.format(flag_pre, flag_name)
 | 
			
		||||
 | 
			
		||||
    # NOTE: Zoltan assumes that it's linking against an MPI library that can
 | 
			
		||||
    # be found with '-lmpi,' which isn't the case for many MPI packages.  This
 | 
			
		||||
    # function finds the names of the actual libraries for Zoltan's MPI dep.
 | 
			
		||||
    def get_mpi_libs(self):
 | 
			
		||||
        mpi_libs = set()
 | 
			
		||||
 | 
			
		||||
        for lib_path in glob.glob(join_path(self.spec['mpi'].prefix.lib, '*')):
 | 
			
		||||
            mpi_lib_match = re.match(
 | 
			
		||||
                r'^(lib)((\w*)mpi(\w*))\.((a)|({0}))$'.format(dso_suffix),
 | 
			
		||||
                os.path.basename(lib_path))
 | 
			
		||||
            if mpi_lib_match:
 | 
			
		||||
                mpi_libs.add(mpi_lib_match.group(2))
 | 
			
		||||
 | 
			
		||||
        return list(mpi_libs)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user