MUMPS: Various improvements to the package (#22575)
Use `conflicts` directive whenever possible. This allows failing early when conflicting variants are used. Do not silently ignore `+parmetis` variant when `~metis`. Instead throw an error during concretization. Simplify the "Makefile.inc" generation. This will make easier to add new variants in the future.
This commit is contained in:
parent
4a059aad17
commit
67f182bb6d
@ -60,12 +60,14 @@ class Mumps(Package):
|
||||
patch('mumps.src-makefile.5.2.patch', when='@5.2.0 +shared')
|
||||
patch('mumps.src-makefile.5.3.patch', when='@5.3.0: +shared')
|
||||
|
||||
def write_makefile_inc(self):
|
||||
if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and (
|
||||
'+mpi' not in self.spec):
|
||||
raise RuntimeError(
|
||||
'You cannot use the variants parmetis or ptscotch without mpi')
|
||||
conflicts('+parmetis', when='~mpi',
|
||||
msg="You cannot use the parmetis variant without mpi")
|
||||
conflicts('+parmetis', when='~metis',
|
||||
msg="You cannot use the parmetis variant without metis")
|
||||
conflicts('+ptscotch', when='~mpi',
|
||||
msg="You cannot use the ptscotch variant without mpi")
|
||||
|
||||
def write_makefile_inc(self):
|
||||
# The makefile variables LIBBLAS, LSCOTCH, LMETIS, and SCALAP are only
|
||||
# used to link the examples, so if building '+shared' there is no need
|
||||
# to explicitly link with the respective libraries because we make sure
|
||||
@ -96,7 +98,7 @@ def write_makefile_inc(self):
|
||||
if '+ptscotch' in self.spec:
|
||||
orderings.append('-Dptscotch')
|
||||
|
||||
if '+parmetis' in self.spec and '+metis' in self.spec:
|
||||
if '+parmetis' in self.spec:
|
||||
makefile_conf.extend([
|
||||
"IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
|
||||
("LMETIS = -L%s -l%s -L%s -l%s" % (
|
||||
@ -136,8 +138,8 @@ def write_makefile_inc(self):
|
||||
# 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
|
||||
cpic = self.compiler.cc_pic_flag if '+shared' in self.spec else ''
|
||||
fpic = self.compiler.fc_pic_flag if '+shared' in self.spec else ''
|
||||
cpic = self.compiler.cc_pic_flag if shared else ''
|
||||
fpic = self.compiler.fc_pic_flag if shared else ''
|
||||
# TODO: test this part, it needs a full blas, scalapack and
|
||||
# partitionning environment with 64bit integers
|
||||
|
||||
@ -147,34 +149,35 @@ def write_makefile_inc(self):
|
||||
|
||||
opt_level = '3' if using_xl else ''
|
||||
|
||||
optc = ['-O{0}'.format(opt_level)]
|
||||
optf = ['-O{0}'.format(opt_level)]
|
||||
optl = ['-O{0}'.format(opt_level)]
|
||||
|
||||
if shared:
|
||||
optc.append(cpic)
|
||||
optf.append(fpic)
|
||||
optl.append(cpic)
|
||||
|
||||
if not using_xlf:
|
||||
optf.append('-DALLOW_NON_INIT')
|
||||
|
||||
if '+int64' in self.spec:
|
||||
if using_xlf:
|
||||
makefile_conf.append('OPTF = -O%s' % opt_level)
|
||||
else:
|
||||
if not using_xlf:
|
||||
# the fortran compilation flags most probably are
|
||||
# working only for intel and gnu compilers this is
|
||||
# perhaps something the compiler should provide
|
||||
makefile_conf.extend([
|
||||
'OPTF = %s -O -DALLOW_NON_INIT %s' % (
|
||||
fpic,
|
||||
'-fdefault-integer-8' if using_gcc else '-i8'), # noqa
|
||||
])
|
||||
optf.append('-fdefault-integer-8' if using_gcc else '-i8')
|
||||
|
||||
makefile_conf.extend([
|
||||
'OPTL = %s -O%s' % (cpic, opt_level),
|
||||
'OPTC = %s -O%s -DINTSIZE64' % (cpic, opt_level)
|
||||
])
|
||||
optc.append('-DINTSIZE64')
|
||||
else:
|
||||
if using_xlf:
|
||||
makefile_conf.append('OPTF = -O%s -qfixed' % opt_level)
|
||||
else:
|
||||
makefile_conf.append('OPTF = %s -O%s -DALLOW_NON_INIT' % (
|
||||
fpic, opt_level))
|
||||
optf.append('-qfixed')
|
||||
|
||||
makefile_conf.extend([
|
||||
'OPTL = %s -O%s' % (cpic, opt_level),
|
||||
'OPTC = %s -O%s' % (cpic, opt_level)
|
||||
])
|
||||
makefile_conf.extend([
|
||||
'OPTC = {0}'.format(' '.join(optc)),
|
||||
'OPTF = {0}'.format(' '.join(optf)),
|
||||
'OPTL = {0}'.format(' '.join(optl))
|
||||
])
|
||||
|
||||
if '+mpi' in self.spec:
|
||||
scalapack = self.spec['scalapack'].libs if not shared \
|
||||
|
Loading…
Reference in New Issue
Block a user