mumps: flake8 fixes
This commit is contained in:
		@@ -23,7 +23,10 @@
 | 
				
			|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 | 
					# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 | 
				
			||||||
##############################################################################
 | 
					##############################################################################
 | 
				
			||||||
from spack import *
 | 
					from spack import *
 | 
				
			||||||
import os, sys, glob
 | 
					import os
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					import glob
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Mumps(Package):
 | 
					class Mumps(Package):
 | 
				
			||||||
    """MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
 | 
					    """MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
 | 
				
			||||||
@@ -44,7 +47,6 @@ class Mumps(Package):
 | 
				
			|||||||
    variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
 | 
					    variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
 | 
				
			||||||
    variant('shared', default=True, description='Build shared libraries')
 | 
					    variant('shared', default=True, description='Build shared libraries')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    depends_on('scotch + esmumps', when='~ptscotch+scotch')
 | 
					    depends_on('scotch + esmumps', when='~ptscotch+scotch')
 | 
				
			||||||
    depends_on('scotch + esmumps + mpi', when='+ptscotch')
 | 
					    depends_on('scotch + esmumps + mpi', when='+ptscotch')
 | 
				
			||||||
    depends_on('metis@5:', when='+metis')
 | 
					    depends_on('metis@5:', when='+metis')
 | 
				
			||||||
@@ -59,8 +61,8 @@ class Mumps(Package):
 | 
				
			|||||||
    # end before install
 | 
					    # end before install
 | 
				
			||||||
    # def patch(self):
 | 
					    # def patch(self):
 | 
				
			||||||
    def write_makefile_inc(self):
 | 
					    def write_makefile_inc(self):
 | 
				
			||||||
        if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
 | 
					        if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:  # NOQA: ignore=E501
 | 
				
			||||||
            raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
 | 
					            raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')  # NOQA: ignore=E501
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        makefile_conf = ["LIBBLAS = %s" % to_link_flags(
 | 
					        makefile_conf = ["LIBBLAS = %s" % to_link_flags(
 | 
				
			||||||
            self.spec['blas'].blas_shared_lib)
 | 
					            self.spec['blas'].blas_shared_lib)
 | 
				
			||||||
@@ -70,33 +72,41 @@ def write_makefile_inc(self):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if '+ptscotch' in self.spec or '+scotch' in self.spec:
 | 
					        if '+ptscotch' in self.spec or '+scotch' in self.spec:
 | 
				
			||||||
            join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
 | 
					            join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
 | 
				
			||||||
            makefile_conf.extend(
 | 
					            makefile_conf.extend([
 | 
				
			||||||
                ["ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
 | 
					                "ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
 | 
				
			||||||
                 "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
 | 
					                "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
 | 
				
			||||||
                                          join_lib,
 | 
					                                         join_lib,
 | 
				
			||||||
                                          join_lib.join(['esmumps', 'scotch', 'scotcherr']))])
 | 
					                                         join_lib.join(['esmumps',
 | 
				
			||||||
 | 
					                                                        'scotch',
 | 
				
			||||||
 | 
					                                                        'scotcherr']))
 | 
				
			||||||
 | 
					            ])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            orderings.append('-Dscotch')
 | 
					            orderings.append('-Dscotch')
 | 
				
			||||||
            if '+ptscotch' in self.spec:
 | 
					            if '+ptscotch' in self.spec:
 | 
				
			||||||
                orderings.append('-Dptscotch')
 | 
					                orderings.append('-Dptscotch')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if '+parmetis' in self.spec and '+metis' in self.spec:
 | 
					        if '+parmetis' in self.spec and '+metis' in self.spec:
 | 
				
			||||||
            libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
 | 
					            makefile_conf.extend([
 | 
				
			||||||
            makefile_conf.extend(
 | 
					                "IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
 | 
				
			||||||
                ["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
 | 
					                "LMETIS = -L%s -l%s -L%s -l%s" % (
 | 
				
			||||||
                 "LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
 | 
					                    self.spec['parmetis'].prefix.lib, 'parmetis',
 | 
				
			||||||
 | 
					                    self.spec['metis'].prefix.lib, 'metis')
 | 
				
			||||||
 | 
					            ])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            orderings.append('-Dparmetis')
 | 
					            orderings.append('-Dparmetis')
 | 
				
			||||||
        elif '+metis' in self.spec:
 | 
					        elif '+metis' in self.spec:
 | 
				
			||||||
            makefile_conf.extend(
 | 
					            makefile_conf.extend([
 | 
				
			||||||
                ["IMETIS = -I%s" % self.spec['metis'].prefix.include,
 | 
					                "IMETIS = -I%s" % self.spec['metis'].prefix.include,
 | 
				
			||||||
                 "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
 | 
					                "LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')
 | 
				
			||||||
 | 
					            ])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            orderings.append('-Dmetis')
 | 
					            orderings.append('-Dmetis')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
 | 
					        makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # when building shared libs need -fPIC, otherwise
 | 
					        # when building shared libs need -fPIC, otherwise
 | 
				
			||||||
        # /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
 | 
					        # /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1'
 | 
				
			||||||
 | 
					        # can not be used when making a shared object; recompile with -fPIC
 | 
				
			||||||
        fpic = '-fPIC' if '+shared' in self.spec else ''
 | 
					        fpic = '-fPIC' if '+shared' in self.spec else ''
 | 
				
			||||||
        # TODO: test this part, it needs a full blas, scalapack and
 | 
					        # TODO: test this part, it needs a full blas, scalapack and
 | 
				
			||||||
        # partitionning environment with 64bit integers
 | 
					        # partitionning environment with 64bit integers
 | 
				
			||||||
@@ -105,7 +115,7 @@ def write_makefile_inc(self):
 | 
				
			|||||||
                # the fortran compilation flags most probably are
 | 
					                # the fortran compilation flags most probably are
 | 
				
			||||||
                # working only for intel and gnu compilers this is
 | 
					                # working only for intel and gnu compilers this is
 | 
				
			||||||
                # perhaps something the compiler should provide
 | 
					                # perhaps something the compiler should provide
 | 
				
			||||||
                ['OPTF    = %s -O  -DALLOW_NON_INIT %s' % (fpic,'-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),
 | 
					                ['OPTF    = %s -O  -DALLOW_NON_INIT %s' % (fpic, '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),  # NOQA: ignore=E501
 | 
				
			||||||
                 'OPTL    = %s -O ' % fpic,
 | 
					                 'OPTL    = %s -O ' % fpic,
 | 
				
			||||||
                 'OPTC    = %s -O -DINTSIZE64' % fpic])
 | 
					                 'OPTC    = %s -O -DINTSIZE64' % fpic])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -114,7 +124,6 @@ def write_makefile_inc(self):
 | 
				
			|||||||
                 'OPTL    = %s -O ' % fpic,
 | 
					                 'OPTL    = %s -O ' % fpic,
 | 
				
			||||||
                 'OPTC    = %s -O ' % fpic])
 | 
					                 'OPTC    = %s -O ' % fpic])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if '+mpi' in self.spec:
 | 
					        if '+mpi' in self.spec:
 | 
				
			||||||
            makefile_conf.extend(
 | 
					            makefile_conf.extend(
 | 
				
			||||||
                ["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
 | 
					                ["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
 | 
				
			||||||
@@ -135,16 +144,17 @@ def write_makefile_inc(self):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if '+shared' in self.spec:
 | 
					        if '+shared' in self.spec:
 | 
				
			||||||
            if sys.platform == 'darwin':
 | 
					            if sys.platform == 'darwin':
 | 
				
			||||||
                # Building dylibs with mpif90 causes segfaults on 10.8 and 10.10. Use gfortran. (Homebrew)
 | 
					                # Building dylibs with mpif90 causes segfaults on 10.8 and
 | 
				
			||||||
 | 
					                # 10.10. Use gfortran. (Homebrew)
 | 
				
			||||||
                makefile_conf.extend([
 | 
					                makefile_conf.extend([
 | 
				
			||||||
                    'LIBEXT=.dylib',
 | 
					                    'LIBEXT=.dylib',
 | 
				
			||||||
                    'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'],prefix.lib),
 | 
					                    'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'], prefix.lib),  # NOQA: ignore=E501
 | 
				
			||||||
                    'RANLIB=echo'
 | 
					                    'RANLIB=echo'
 | 
				
			||||||
                ])
 | 
					                ])
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                makefile_conf.extend([
 | 
					                makefile_conf.extend([
 | 
				
			||||||
                    'LIBEXT=.so',
 | 
					                    'LIBEXT=.so',
 | 
				
			||||||
                    'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,
 | 
					                    'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,  # NOQA: ignore=E501
 | 
				
			||||||
                    'RANLIB=echo'
 | 
					                    'RANLIB=echo'
 | 
				
			||||||
                ])
 | 
					                ])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -154,9 +164,8 @@ def write_makefile_inc(self):
 | 
				
			|||||||
                'RANLIB = ranlib'
 | 
					                'RANLIB = ranlib'
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        makefile_inc_template = join_path(
 | 
				
			||||||
        makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
 | 
					            os.path.dirname(self.module.__file__), 'Makefile.inc')
 | 
				
			||||||
                                          'Makefile.inc')
 | 
					 | 
				
			||||||
        with open(makefile_inc_template, "r") as fh:
 | 
					        with open(makefile_inc_template, "r") as fh:
 | 
				
			||||||
            makefile_conf.extend(fh.read().split('\n'))
 | 
					            makefile_conf.extend(fh.read().split('\n'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -165,8 +174,6 @@ def write_makefile_inc(self):
 | 
				
			|||||||
                makefile_inc = '\n'.join(makefile_conf)
 | 
					                makefile_inc = '\n'.join(makefile_conf)
 | 
				
			||||||
                fh.write(makefile_inc)
 | 
					                fh.write(makefile_inc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def install(self, spec, prefix):
 | 
					    def install(self, spec, prefix):
 | 
				
			||||||
        make_libs = []
 | 
					        make_libs = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -194,11 +201,11 @@ def install(self, spec, prefix):
 | 
				
			|||||||
            lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
 | 
					            lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
 | 
				
			||||||
            lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
 | 
					            lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
 | 
				
			||||||
            install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
 | 
					            install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
 | 
				
			||||||
            for f in glob.glob(join_path('libseq','*.h')):
 | 
					            for f in glob.glob(join_path('libseq', '*.h')):
 | 
				
			||||||
                install(f, prefix.include)
 | 
					                install(f, prefix.include)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # FIXME: extend the tests to mpirun -np 2 (or alike) when build with MPI
 | 
					        # FIXME: extend the tests to mpirun -np 2 when build with MPI
 | 
				
			||||||
        # FIXME: use something like numdiff to compare blessed output with the current
 | 
					        # FIXME: use something like numdiff to compare output files
 | 
				
			||||||
        with working_dir('examples'):
 | 
					        with working_dir('examples'):
 | 
				
			||||||
            if '+float' in spec:
 | 
					            if '+float' in spec:
 | 
				
			||||||
                os.system('./ssimpletest < input_simpletest_real')
 | 
					                os.system('./ssimpletest < input_simpletest_real')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user