Add xl and spectrum mpi support for mumps (#3231)

* Add xl and spectrum mpi support for mumps

* Incorporated Denis's comments. fPIC and if-else
This commit is contained in:
eklee15 2017-03-01 16:33:41 -05:00 committed by Adam J. Stewart
parent 4e601bb6d3
commit 8b52a87285
2 changed files with 118 additions and 16 deletions

View file

@ -68,6 +68,9 @@ class Mumps(Package):
depends_on('scalapack', when='+mpi')
depends_on('mpi', when='+mpi')
patch('spectrum-mpi-xl.patch', when='%xl^spectrum-mpi')
patch('spectrum-mpi-xl.patch', when='%xl_r^spectrum-mpi')
# this function is not a patch function because in case scalapack
# is needed it uses self.spec['scalapack'].fc_link set by the
# setup_dependent_environment in scalapck. This happen after patch
@ -122,10 +125,17 @@ 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
fpic = '-fPIC' if '+shared' in self.spec else ''
fpic = self.compiler.pic_flag if '+shared' in self.spec else ''
# TODO: test this part, it needs a full blas, scalapack and
# partitionning environment with 64bit integers
if '+int64' in self.spec:
if self.compiler.name == "xl" or self.compiler.name == "xl_r":
makefile_conf.extend(
['OPTF = -O3',
'OPTL = %s -O3' % fpic,
'OPTC = %s -O3-DINTSIZE64' % fpic])
else:
makefile_conf.extend(
# the fortran compilation flags most probably are
# working only for intel and gnu compilers this is
@ -133,6 +143,12 @@ def write_makefile_inc(self):
['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic, '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'), # noqa
'OPTL = %s -O ' % fpic,
'OPTC = %s -O -DINTSIZE64' % fpic])
else:
if self.compiler.name == "xl" or self.compiler.name == "xl_r":
makefile_conf.extend(
['OPTF = -O3',
'OPTL = %s -O3' % fpic,
'OPTC = %s -O3' % fpic])
else:
makefile_conf.extend(
['OPTF = %s -O -DALLOW_NON_INIT' % fpic,
@ -142,11 +158,16 @@ def write_makefile_inc(self):
if '+mpi' in self.spec:
scalapack = self.spec['scalapack'].scalapack_libs
makefile_conf.extend(
["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
"FC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
"FL = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
['CC = {0}'.format(self.spec['mpi'].mpicc),
'FC = {0}'.format(self.spec['mpi'].mpifc),
"SCALAP = %s" % scalapack.ld_flags,
"MUMPS_TYPE = par"])
if (self.spec.satisfies('%xl_r' or '%xl')) and self.spec.satisfies('^spectrum-mpi'): # noqa
makefile_conf.extend(
['FL = {0}'.format(self.spec['mpi'].mpicc)])
else:
makefile_conf.extend(
['FL = {0}'.format(self.spec['mpi'].mpifc)])
else:
makefile_conf.extend(
["CC = cc",
@ -162,6 +183,7 @@ def write_makefile_inc(self):
# hack defined by _DMAIN_COMP (see examples/c_example.c)
makefile_conf.append("CDEFS = -DAdd_ -DMAIN_COMP")
else:
if self.compiler.name != "xl" and self.compiler.name != "xl_r":
makefile_conf.append("CDEFS = -DAdd_")
if '+shared' in self.spec:
@ -179,6 +201,11 @@ def write_makefile_inc(self):
'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib, # noqa
'RANLIB=echo'
])
if self.compiler.name == 'xl' or self.compiler.name == 'xl_r':
makefile_conf.extend([
'SAR=/bin/xlc -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib # noqa
])
else:
makefile_conf.extend([
'LIBEXT = .a',

View file

@ -0,0 +1,75 @@
diff -Naur MUMPS_5.0.1/Makefile MUMPS_5.0.1-patched/MUMPS_5.0.1/Makefile
--- ./Makefile 2015-07-23 13:08:29.000000000 -0400
+++ ./Makefile 2016-12-05 14:08:30.788638382 -0500
@@ -62,7 +62,7 @@
$(libdir)/libpord$(PLAT)$(LIBEXT):
if [ "$(LPORDDIR)" != "" ] ; then \
cd $(LPORDDIR); \
- $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
+ $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" SAR="$(SAR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
fi;
if [ "$(LPORDDIR)" != "" ] ; then \
cp $(LPORDDIR)/libpord$(LIBEXT) $@; \
diff -Naur MUMPS_5.0.1/PORD/lib/Makefile MUMPS_5.0.1-patched/PORD/lib/MUMPS_5.0.1/Makefile
--- ./PORD/lib/Makefile 2015-07-23 13:08:29.000000000 -0400
+++ ./PORD/lib/Makefile 2016-12-05 11:26:24.785317467 -0500
@@ -25,7 +25,7 @@
$(CC) $(COPTIONS) -c $*.c $(OUTC)$*.o
libpord$(LIBEXT):$(OBJS)
- $(AR)$@ $(OBJS)
+ $(SAR)$@ $(OBJS)
$(RANLIB) $@
clean:
diff -Naur MUMPS_5.0.1/examples/Makefile MUMPS_5.0.1-patched/examples/Makefile
--- ./examples/Makefile 2015-07-23 13:08:32.000000000 -0400
+++ ./examples/Makefile 2016-12-05 14:36:10.692857906 -0500
@@ -25,37 +25,30 @@
LIBSMUMPS = $(libdir)/libsmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
-ssimpletest: $(LIBSMUMPS) $$@.o
- $(FL) -o $@ $(OPTL) ssimpletest.o $(LIBSMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+ssimpletest: $(LIBSMUMPS) $$@.F
+ $(FC) -o $@ $(OPTF) $(INCS) -I. -I$(topdir)/include ssimpletest.F $(LIBSMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
LIBDMUMPS = $(libdir)/libdmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
-dsimpletest: $(LIBDMUMPS) $$@.o
- $(FL) -o $@ $(OPTL) dsimpletest.o $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+dsimpletest: $(LIBDMUMPS) $$@.F
+ $(FC) -o $@ $(OPTF) $(INCS) -I. -I$(topdir)/include dsimpletest.F $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
LIBCMUMPS = $(libdir)/libcmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
-csimpletest: $(LIBCMUMPS) $$@.o
- $(FL) -o $@ $(OPTL) csimpletest.o $(LIBCMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+csimpletest: $(LIBCMUMPS) $$@.F
+ $(FC) -o $@ $(OPTF) $(INCS) -I. -I$(topdir)/include csimpletest.F $(LIBCMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
LIBZMUMPS = $(libdir)/libzmumps$(PLAT)$(LIBEXT) $(LIBMUMPS_COMMON)
-zsimpletest: $(LIBZMUMPS) $$@.o
- $(FL) -o $@ $(OPTL) zsimpletest.o $(LIBZMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
+zsimpletest: $(LIBZMUMPS) $$@.F
+ $(FC) -o $@ $(OPTF) $(INCS) -I. -I$(topdir)/include zsimpletest.F $(LIBZMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
-c_example: $(LIBDMUMPS) $$@.o
- $(FL) -o $@ $(OPTL) $@.o $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
-
-
-.SUFFIXES: .c .F .o
-.F.o:
- $(FC) $(OPTF) $(INCS) -I. -I$(topdir)/include -c $*.F $(OUTF)$*.o
-.c.o:
- $(CC) $(OPTC) $(INCS) $(CDEFS) -I. -I$(topdir)/include -I$(topdir)/src -c $*.c $(OUTC)$*.o
+c_example: $(LIBDMUMPS) $$@.c
+ $(CC) -o $@ $(OPTC) $(INCS) -I. -I$(topdir)/include c_example.c $(LIBDMUMPS) $(LORDERINGS) $(LIBS) $(LIBBLAS) $(LIBOTHERS)
$(libdir)/libsmumps$(PLAT)$(LIBEXT):