From e4c22efc8547a42e8c72faf7154effef765c1b81 Mon Sep 17 00:00:00 2001 From: Akhil Reddy Patlolla Date: Thu, 10 Aug 2017 20:08:56 -0500 Subject: Variants Serial MPI openmp (#4897) * Variants Serial MPI openmp * Fixed Flake8 Issue and remove Patch File * Fixed issues with openmp Flag * Edited Required Changes * Fixed issues with flake8 and Added Conditional GCC Flags * Fixed Flake 8 Issue * Fixed flag's issue with non GCC Compiler * Fixed condition and spacing issues --- var/spack/repos/builtin/packages/lulesh/package.py | 66 +++++++++++++++------- .../builtin/packages/lulesh/remove_defaults.patch | 60 -------------------- 2 files changed, 47 insertions(+), 79 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/lulesh/remove_defaults.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/lulesh/package.py b/var/spack/repos/builtin/packages/lulesh/package.py index 94f3ad5b14..2dd4a4edd2 100644 --- a/var/spack/repos/builtin/packages/lulesh/package.py +++ b/var/spack/repos/builtin/packages/lulesh/package.py @@ -23,34 +23,62 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * -import os -class Lulesh(Package): - """Livermore Unstructured Lagrangian Explicit Shock Hydrodynamics (LULESH) +class Lulesh(MakefilePackage): + """LULESH is a highly simplified application, hard-coded to only + style typical in scientific C or C++ based applications. Hard + code to only solve a Sedov blast problem with analytic answer """ - + tags = ['proxy-app'] homepage = "https://codesign.llnl.gov/lulesh.php" url = "https://codesign.llnl.gov/lulesh/lulesh2.0.3.tgz" - tags = ['proxy-app'] - version("2.0.3", "336644a8750f71c7c6b9d2960976e7aa") + version('2.0.3', '336644a8750f71c7c6b9d2960976e7aa') - patch("remove_defaults.patch") + variant('mpi', default=True, description='Build with MPI support') + variant('openmp', default=True, description='Build with OpenMP support') + variant('visual', default=False, + description='Build with Visualization support (Silo, hdf5)') - variant('mpip', default=False) + depends_on('mpi', when='+mpi') + depends_on('silo', when='+visual') + depends_on('hdf5', when='+visual') - depends_on("mpi", type="build") - depends_on("mpip", when="+mpip") + @property + def build_targets(self): + targets = [] + cxxflag = ' -g -O3 -I. ' + ldflags = ' -g -O3 ' + if '~mpi' in self.spec: + targets.append('CXX = {0} {1}'.format(spack_cxx, ' -DUSE_MPI=0 ')) + else: + targets.append( + 'CXX = {0} {1}'.format(self.spec['mpi'].mpicxx, + ' -DUSE_MPI=1')) + targets.append( + 'MPI_INC = {0}'.format(self.spec['mpi'].prefix.include)) + targets.append('MPI_LIB = {0}'.format(self.spec['mpi'].prefix.lib)) + if '+visual' in self.spec: + targets.append( + 'SILO_INCDIR = {0}'.format(self.spec['silo'].prefix.include)) + targets.append( + 'SILO_LIBDIR = {0}'.format(self.spec['silo'].prefix.lib)) + cxxflag = ' -g -DVIZ_MESH -I${SILO_INCDIR} ' + ldflags = ' -g -L${SILO_LIBDIR} -Wl,-rpath -Wl, ' + ldflags += '${SILO_LIBDIR} -lsiloh5 -lhdf5 ' - def install(self, spec, prefix): - if '+mpip' in spec: - os.environ["LDFLAGS"] = " -lmpiP -ldwarf -lelf" + if '+openmp' in self.spec: + cxxflag += self.compiler.openmp_flag + ldflags += self.compiler.openmp_flag - if os.uname()[4] == "x86_64": - os.environ["LDFLAGS"] += " -lunwind" + targets.append('CXXFLAGS = {0}'.format(cxxflag)) + targets.append('LDFLAGS = {0}'.format(ldflags)) + return targets - os.environ["CXX"] = spec['mpi'].mpicxx + " -DUSE_MPI=1" - os.environ["PREFIX"] = prefix - make() - make("install") + def install(self, spec, prefix): + mkdirp(prefix.bin) + install('lulesh{0}'.format(self.version.up_to(2)), prefix.bin) + mkdirp(prefix.doc) + install('README', prefix.doc) + install('TODO', prefix.doc) \ No newline at end of file diff --git a/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch b/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch deleted file mode 100644 index 36cce25ba1..0000000000 --- a/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -1,17 +1,9 @@ - #default build suggestion of MPI + OPENMP with gcc on Livermore machines you might have to change the compiler name - --SHELL = /bin/sh - .SUFFIXES: .cc .o - - LULESH_EXEC = lulesh2.0 - --MPI_INC = /opt/local/include/openmpi --MPI_LIB = /opt/local/lib -- --SERCXX = g++ -DUSE_MPI=0 --MPICXX = mpig++ -DUSE_MPI=1 --CXX = $(MPICXX) -- - SOURCES2.0 = \ - lulesh.cc \ - lulesh-comm.cc \ -@@ -20,28 +12,6 @@ - lulesh-init.cc - OBJECTS2.0 = $(SOURCES2.0:.cc=.o) - --#Default build suggestions with OpenMP for g++ --CXXFLAGS = -g -O3 -fopenmp -I. -Wall --LDFLAGS = -g -O3 -fopenmp -- --#Below are reasonable default flags for a serial build --#CXXFLAGS = -g -O3 -I. -Wall --#LDFLAGS = -g -O3 -- --#common places you might find silo on the Livermore machines. --#SILO_INCDIR = /opt/local/include --#SILO_LIBDIR = /opt/local/lib --#SILO_INCDIR = ./silo/4.9/1.8.10.1/include --#SILO_LIBDIR = ./silo/4.9/1.8.10.1/lib -- --#If you do not have silo and visit you can get them at: --#silo: https://wci.llnl.gov/codes/silo/downloads.html --#visit: https://wci.llnl.gov/codes/visit/download.html -- --#below is and example of how to make with silo, hdf5 to get vizulization by default all this is turned off. All paths are Livermore specific. --#CXXFLAGS = -g -DVIZ_MESH -I${SILO_INCDIR} -Wall -Wno-pragmas --#LDFLAGS = -g -L${SILO_LIBDIR} -Wl,-rpath -Wl,${SILO_LIBDIR} -lsiloh5 -lhdf5 -- - .cc.o: lulesh.h - @echo "Building $<" - $(CXX) -c $(CXXFLAGS) -o $@ $< -@@ -56,6 +26,7 @@ - /bin/rm -f *.o *~ $(OBJECTS) $(LULESH_EXEC) - /bin/rm -rf *.dSYM - --tar: clean -- cd .. ; tar cvf lulesh-2.0.tar LULESH-2.0 ; mv lulesh-2.0.tar LULESH-2.0 -- -+install: lulesh2.0 -+ @echo "Installing" -+ mkdir -p $(PREFIX)/bin -+ install --mode=755 lulesh2.0 $(PREFIX)/bin/ -- cgit v1.2.3-70-g09d2