summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreklee15 <eunkyung.lee@us.ibm.com>2017-03-01 16:33:41 -0500
committerAdam J. Stewart <ajstewart426@gmail.com>2017-03-01 15:33:41 -0600
commit8b52a87285025387635e146345bfd04cb9e8fc5c (patch)
tree5294ef4017fe1a32e2c9bcaa84f71e8e9a60b741
parent4e601bb6d3c4c4376293c06c6bc29b759eadf651 (diff)
downloadspack-8b52a87285025387635e146345bfd04cb9e8fc5c.tar.gz
spack-8b52a87285025387635e146345bfd04cb9e8fc5c.tar.bz2
spack-8b52a87285025387635e146345bfd04cb9e8fc5c.tar.xz
spack-8b52a87285025387635e146345bfd04cb9e8fc5c.zip
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
-rw-r--r--var/spack/repos/builtin/packages/mumps/package.py59
-rw-r--r--var/spack/repos/builtin/packages/mumps/spectrum-mpi-xl.patch75
2 files changed, 118 insertions, 16 deletions
diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py
index 1d87d6f35a..9fd5b5f36b 100644
--- a/var/spack/repos/builtin/packages/mumps/package.py
+++ b/var/spack/repos/builtin/packages/mumps/package.py
@@ -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,31 +125,49 @@ class Mumps(Package):
# 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:
- makefile_conf.extend(
- # the fortran compilation flags most probably are
- # working only for intel and gnu compilers this is
- # perhaps something the compiler should provide
- ['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])
+ 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
+ # perhaps something the compiler should provide
+ ['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:
- makefile_conf.extend(
- ['OPTF = %s -O -DALLOW_NON_INIT' % fpic,
- 'OPTL = %s -O ' % fpic,
- 'OPTC = %s -O ' % fpic])
+ 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,
+ 'OPTL = %s -O ' % fpic,
+ 'OPTC = %s -O ' % fpic])
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,7 +183,8 @@ class Mumps(Package):
# hack defined by _DMAIN_COMP (see examples/c_example.c)
makefile_conf.append("CDEFS = -DAdd_ -DMAIN_COMP")
else:
- makefile_conf.append("CDEFS = -DAdd_")
+ if self.compiler.name != "xl" and self.compiler.name != "xl_r":
+ makefile_conf.append("CDEFS = -DAdd_")
if '+shared' in self.spec:
if sys.platform == 'darwin':
@@ -179,6 +201,11 @@ class Mumps(Package):
'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',
diff --git a/var/spack/repos/builtin/packages/mumps/spectrum-mpi-xl.patch b/var/spack/repos/builtin/packages/mumps/spectrum-mpi-xl.patch
new file mode 100644
index 0000000000..d2bd17cb44
--- /dev/null
+++ b/var/spack/repos/builtin/packages/mumps/spectrum-mpi-xl.patch
@@ -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):