From 032ea076a3f0e5e61ba3dc3074d02d62cacf1bb0 Mon Sep 17 00:00:00 2001 From: kiel friedt <friedt2@llnl.gov> Date: Tue, 21 Feb 2017 10:22:26 -0800 Subject: [PATCH] added changes from barrys xsdk branch to wip --- .../builtin/packages/alquimia/package.py | 79 +++++++++++++++++ .../packages/alquimia/petsc_arch.patch | 33 +++++++ .../repos/builtin/packages/hypre/package.py | 1 + .../repos/builtin/packages/petsc/package.py | 63 ++++++++++---- .../builtin/packages/pflotran/package.py | 4 +- .../builtin/packages/superlu-dist/package.py | 1 + .../builtin/packages/trilinos/package.py | 7 +- .../repos/builtin/packages/xsdk/package.py | 86 +++++++++++++++++++ .../builtin/packages/xsdktrilinos/package.py | 7 ++ 9 files changed, 260 insertions(+), 21 deletions(-) create mode 100644 var/spack/repos/builtin/packages/alquimia/package.py create mode 100644 var/spack/repos/builtin/packages/alquimia/petsc_arch.patch create mode 100644 var/spack/repos/builtin/packages/xsdk/package.py diff --git a/var/spack/repos/builtin/packages/alquimia/package.py b/var/spack/repos/builtin/packages/alquimia/package.py new file mode 100644 index 0000000000..c16a20cdf4 --- /dev/null +++ b/var/spack/repos/builtin/packages/alquimia/package.py @@ -0,0 +1,79 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class Alquimia(CMakePackage): + """Alquimia is an interface that exposes the capabilities + of mature geochemistry codes such as CrunchFlow and PFLOTRAN""" + + homepage = "https://github.com/LBL-EESA/alquimia-dev" + + version('xsdk-0.2.0', git='https://github.com/ghammond86/alquimia-dev.git') + version('develop', git='https://github.com/ghammond86/alquimia-dev.git') + + variant('shared', default=True, + description='Enables the build of shared libraries') + variant('debug', default=False, + description='Builds a debug version of the libraries') + + depends_on('mpi') + depends_on('hdf5') + depends_on('pflotran@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('pflotran@develop', when='@develop') + depends_on('petsc@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('petsc@develop', when='@develop') + + patch('petsc_arch.patch') + + def cmake_args(self): + spec = self.spec + + options = ['-DCMAKE_C_COMPILER=%s' % self.spec['mpi'].mpicc, + '-DCMAKE_Fortran_COMPILER=%s' % self.spec['mpi'].mpifc] + + options.extend([ + '-DUSE_XSDK_DEFAULTS=YES', + '-DCMAKE_BUILD_TYPE:STRING=%s' % ( + 'DEBUG' if '+debug' in spec else 'RELEASE'), + '-DXSDK_ENABLE_DEBUG:STRING=%s' % ( + 'YES' if '+debug' in spec else 'NO'), + '-DBUILD_SHARED_LIBS:BOOL=%s' % ( + 'ON' if '+shared' in spec else 'OFF'), + '-DTPL_ENABLE_MPI:BOOL=ON', + '-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix, + '-DTPL_ENABLE_HDF5:BOOL=ON', + '-DXSDK_WITH_PFLOTRAN:BOOL=ON', + # This is not good. + # It assumes that the .a file exists and is not a .so + '-DTPL_PFLOTRAN_LIBRARIES=%s' % ( + spec['pflotran'].prefix.lib + "/libpflotranchem.a"), + '-DTPL_PFLOTRAN_INCLUDE_DIRS=%s' % spec['pflotran'].prefix.include, + '-DTPL_ENABLE_PETSC:BOOL=ON', + '-DPETSC_EXECUTABLE_RUNS=ON', + '-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % self.prefix + ]) + + return options diff --git a/var/spack/repos/builtin/packages/alquimia/petsc_arch.patch b/var/spack/repos/builtin/packages/alquimia/petsc_arch.patch new file mode 100644 index 0000000000..08a0e3481c --- /dev/null +++ b/var/spack/repos/builtin/packages/alquimia/petsc_arch.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 730f4d1..b33163d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -188,11 +188,11 @@ if (ALQUIMIA_NEED_PETSC) + if ($ENV{PETSC_DIR} STREQUAL "") + message(FATAL_ERROR "PETSC_DIR must be set for the requested engines to be enabled.") + endif() +- if ($ENV{PETSC_ARCH} STREQUAL "") +- message(FATAL_ERROR "PETSC_ARCH must be set for the requested engines to be enabled.") +- endif() + set(PETSC_DIR $ENV{PETSC_DIR}) +- set(PETSC_ARCH $ENV{PETSC_ARCH}) ++ ++ if(DEFINED $ENV{PETSC_ARCH}) ++ set(PETSC_ARCH $ENV{PETSC_ARCH}) ++ endif() + + # Do we have settings for PETSc's libraries/includes? + if (TPL_PETSC_INCLUDE_DIRS) +@@ -228,7 +228,11 @@ if (ALQUIMIA_NEED_PETSC) + include_directories(${PETSC_INCLUDES}) + + # Include PETSc in the rpath. +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${PETSC_DIR}/${PETSC_ARCH}/lib") ++ if(DEFINED ${PETSC_ARCH}) ++ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${PETSC_DIR}/${PETSC_ARCH}/lib") ++ else() ++ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${PETSC_DIR}/lib") ++ endif() + endif() + + # Include the binary directory in the header file search path, diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index 82a6b06b1f..6a1ebbaf3b 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -36,6 +36,7 @@ class Hypre(Package): url = "http://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz" version('develop', git='https://github.com/LLNL/hypre', tag='master') + version('xsdk-0.2.0', git='https://github.com/LLNL/hypre', tag='master') version('2.11.1', '3f02ef8fd679239a6723f60b7f796519') version('2.10.1', 'dc048c4cabb3cd549af72591474ad674') version('2.10.0b', '768be38793a35bb5d055905b271f5b8e') diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 7d51bbad48..01a5488049 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -24,7 +24,6 @@ ############################################################################## import os -import sys from spack import * @@ -38,9 +37,11 @@ class Petsc(Package): url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.5.3.tar.gz" version('develop', git='https://bitbucket.org/petsc/petsc.git', tag='master') + version('xsdk-0.2.0', git='https://bitbucket.org/petsc/petsc.git', tag='master') version('for-pflotran-0.1.0', git='https://bitbucket.org/petsc/petsc.git', commit='7943f4e1472fff9cf1fc630a1100136616e4970f') + version('3.7.5', 'f00f6e6a3bac39052350dd47194b58a3') version('3.7.4', 'aaf94fa54ef83022c14091f10866eedf') version('3.7.2', '50da49867ce7a49e7a0c1b37f4ec7b34') version('3.6.4', '7632da2375a3df35b8891c9526dbdde7') @@ -65,15 +66,22 @@ class Petsc(Package): variant('boost', default=True, description='Activates support for Boost') variant('hypre', default=True, description='Activates support for Hypre (only parallel)') - variant('mumps', default=True, - description='Activates support for MUMPS (only parallel)') + variant('mumps', default=False, + description='Activates support for MUMPS (only parallel' + ' and 32bit indices)') variant('superlu-dist', default=True, description='Activates support for SuperluDist (only parallel)') + variant('trilinos', default=False, + description='Activates support for Trilinos (only parallel)') + variant('int64', default=False, + description='Compile with 64bit indices') # Virtual dependencies # Git repository needs sowing to build Fortran interface depends_on('sowing', when='@develop') + # PETSc, hypre, superlu_dist when built with int64 use 32 bit integers + # with BLAS/LAPACK depends_on('blas') depends_on('lapack') depends_on('mpi', when='+mpi') @@ -83,7 +91,8 @@ class Petsc(Package): # Other dependencies depends_on('boost', when='@:3.5+boost') - depends_on('metis@5:', when='+metis') + depends_on('metis@5:~int64', when='+metis~int64') + depends_on('metis@5:+int64', when='+metis+int64') depends_on('hdf5+mpi', when='+hdf5+mpi') depends_on('parmetis', when='+metis+mpi') @@ -91,13 +100,29 @@ class Petsc(Package): # Also PETSc prefer to build it without internal superlu, likely due to # conflict in headers see # https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py - depends_on('hypre~internal-superlu', when='+hypre+mpi~complex') - depends_on('superlu-dist@:4.3', when='@3.4.4:3.6.4+superlu-dist+mpi') - depends_on('superlu-dist@5.0.0:', when='@3.7:+superlu-dist+mpi') - depends_on('superlu-dist@5.0.0:', when='@for-pflotran-0.1.0+superlu-dist+mpi') - depends_on('mumps+mpi', when='+mumps+mpi') + depends_on('hypre~internal-superlu~int64', when='+hypre+mpi~complex~int64') + depends_on('hypre@xsdk-0.2.0~internal-superlu+int64', when='@xsdk-0.2.0+hypre+mpi~complex+int64') + depends_on('hypre@xsdk-0.2.0~internal-superlu~int64', when='@xsdk-0.2.0+hypre+mpi~complex~int64') + depends_on('hypre@develop~internal-superlu+int64', when='@develop+hypre+mpi~complex+int64') + depends_on('hypre@develop~internal-superlu~int64', when='@develop+hypre+mpi~complex~int64') + depends_on('hypre~internal-superlu+int64', when='+hypre+mpi~complex+int64') + depends_on('superlu-dist@:4.3~int64', when='@3.4.4:3.6.4+superlu-dist+mpi~int64') + depends_on('superlu-dist@:4.3+int64', when='@3.4.4:3.6.4+superlu-dist+mpi+int64') + depends_on('superlu-dist@5.0.0:~int64', when='@3.7:+superlu-dist+mpi~int64') + depends_on('superlu-dist@5.0.0:+int64', when='@3.7:+superlu-dist+mpi+int64') + depends_on('superlu-dist@5.0.0:~int64', when='@for-pflotran-0.1.0+superlu-dist+mpi~int64') + depends_on('superlu-dist@5.0.0:+int64', when='@for-pflotran-0.1.0+superlu-dist+mpi+int64') + depends_on('superlu-dist@xsdk-0.2.0~int64', when='@xsdk-0.2.0+superlu-dist+mpi~int64') + depends_on('superlu-dist@xsdk-0.2.0+int64', when='@xsdk-0.2.0+superlu-dist+mpi+int64') + depends_on('superlu-dist@develop~int64', when='@develop+superlu-dist+mpi~int64') + depends_on('superlu-dist@develop+int64', when='@develop+superlu-dist+mpi+int64') + depends_on('mumps+mpi', when='+mumps+mpi~int64') + depends_on('scalapack', when='+mumps+mpi~int64') depends_on('scalapack', when='+mumps+mpi') - + depends_on('trilinos@12.6.2:', when='@3.7.0:+trilinos+mpi') + depends_on('trilinos@xsdk-0.2.0', when='@xsdk-0.2.0+trilinos+mpi') + depends_on('trilinos@develop', when='@xdevelop+trilinos+mpi') + def mpi_dependent_options(self): if '~mpi' in self.spec: compiler_opts = [ @@ -122,14 +147,10 @@ def mpi_dependent_options(self): raise RuntimeError('\n'.join(errors)) else: compiler_opts = [ - '--with-mpi=1', - '--with-mpi-dir=%s' % self.spec['mpi'].prefix, + '--with-cc=%s' % self.spec['mpi'].mpicc, + '--with-cxx=%s' % self.spec['mpi'].mpicxx, + '--with-fc=%s' % self.spec['mpi'].mpifc ] - if sys.platform != "darwin": - compiler_opts.extend([ - '--with-cpp=cpp', - '--with-cxxcpp=cpp', - ]) return compiler_opts def install(self, spec, prefix): @@ -145,7 +166,8 @@ def install(self, spec, prefix): '--with-scalar-type=%s' % ( 'complex' if '+complex' in spec else 'real'), '--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'), - '--with-debugging=%s' % ('1' if '+debug' in spec else '0') + '--with-debugging=%s' % ('1' if '+debug' in spec else '0'), + '--with-64-bit-indices=%s' % ('1' if '+int64' in spec else '0') ]) # Make sure we use exactly the same Blas/Lapack libraries # across the DAG. To that end list them explicitly @@ -154,9 +176,12 @@ def install(self, spec, prefix): '--with-blas-lapack-lib=%s' % lapack_blas.joined() ]) + if 'trilinos' in spec: + options.append('--with-cxx-dialect=C++11') + # Activates library support if needed for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis', - 'mumps', 'scalapack'): + 'mumps', 'scalapack', 'trilinos'): options.append( '--with-{library}={value}'.format( library=library, value=('1' if library in spec else '0')) diff --git a/var/spack/repos/builtin/packages/pflotran/package.py b/var/spack/repos/builtin/packages/pflotran/package.py index 347f792453..3df65212b0 100644 --- a/var/spack/repos/builtin/packages/pflotran/package.py +++ b/var/spack/repos/builtin/packages/pflotran/package.py @@ -34,6 +34,7 @@ class Pflotran(AutotoolsPackage): homepage = "http://www.pflotran.org" version('develop', hg='https://bitbucket.org/pflotran/pflotran-xsdk') + version('xsdk-0.2.0', hg='https://bitbucket.org/pflotran/pflotran-xsdk') version('0.1.0', hg='https://bitbucket.org/pflotran/pflotran-xsdk', commmit='4734cf5e606b') @@ -41,5 +42,6 @@ class Pflotran(AutotoolsPackage): depends_on('hdf5@1.8.12+mpi+fortran') depends_on('petsc@develop+hdf5+metis',when='@develop') depends_on('petsc@for-pflotran-0.1.0+hdf5+metis',when='@0.1.0') - + depends_on('petsc@xsdk-0.2.0+hdf5+metis', when='@xsdk-0.2.0') + depends_on('petsc@for-pflotran-0.1.0+hdf5+metis', when='@0.1.0') parallel = False diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py index 7d04673182..edbd820770 100644 --- a/var/spack/repos/builtin/packages/superlu-dist/package.py +++ b/var/spack/repos/builtin/packages/superlu-dist/package.py @@ -34,6 +34,7 @@ class SuperluDist(Package): url = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_dist_4.1.tar.gz" version('develop', git='https://github.com/xiaoyeli/superlu_dist', tag='master') + version('xsdk-0.2.0', git='https://github.com/xiaoyeli/superlu_dist', tag='master') version('5.1.1', '12638c631733a27dcbd87110e9f9cb1e') version('5.1.0', '6bb86e630bd4bd8650243aed8fd92eb9') version('5.0.0', '2b53baf1b0ddbd9fcf724992577f0670') diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 7558430953..3d32ec1df4 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -44,7 +44,8 @@ class Trilinos(CMakePackage): """ homepage = "https://trilinos.org/" base_url = "https://github.com/trilinos/Trilinos/archive" - + version('xsdk-0.2.0', + git='https://github.com/trilinos/Trilinos.git', tag='develop') version('develop', git='https://github.com/trilinos/Trilinos.git', tag='develop') version('master', @@ -114,6 +115,10 @@ def url_for_version(self, version): # work at the end. But let's avoid all this by simply using shared libs depends_on('mumps@5.0:+mpi+shared', when='+mumps') depends_on('scalapack', when='+mumps') + depends_on('superlu-dist@develop', when='@develop:+superlu-dist') + depends_on('superlu-dist@xsdk-0.2.0', when='@xsdk-0.2.0+superlu-dist') + depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre') + depends_on('hypre@develop~internal-superlu', when='@develop+hypre') depends_on('superlu-dist@:4.3', when='@:12.6.1+superlu-dist') depends_on('superlu-dist', when='@12.6.2:+superlu-dist') depends_on('superlu+fpic@4.3', when='+superlu') diff --git a/var/spack/repos/builtin/packages/xsdk/package.py b/var/spack/repos/builtin/packages/xsdk/package.py new file mode 100644 index 0000000000..3d04163286 --- /dev/null +++ b/var/spack/repos/builtin/packages/xsdk/package.py @@ -0,0 +1,86 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## + +import os +from spack import * + + +class Xsdk(Package): + """Xsdk is a suite of Department of Energy (DOE) packages for numerical + simulation. This is a Spack bundle package that installs the xSDK + packages + """ + + homepage = "http://xsdk.info" + + # Dummy url since Spack complains if I don't list something, will be + # removed when metapackage is available + url = 'https://bitbucket.org/saws/saws/get/master.tar.gz' + + # Spack can not handle both the support and 0.2.0 so + # comment out the 0.2.0 version + # this is for testing with the master of each package + version('develop', '941a541bdf625856be18c9752249146d') + # this is for next planned release + version('xsdk-0.2.0', '941a541bdf625856be18c9752249146d') + + depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0') + depends_on('hypre@develop~internal-superlu', when='@develop') + + depends_on('superlu-dist@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('superlu-dist@develop', when='@develop') + + depends_on('trilinos@xsdk-0.2.0+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse', + when='@xsdk-0.2.0') + depends_on('trilinos@develop+xsdkflags+hypre+superlu-dist+metis+hdf5~mumps+boost~suite-sparse', + when='@develop') + + depends_on('petsc@xsdk-0.2.0+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps~boost', + when='@xsdk-0.2.0') + depends_on('petsc@develop+trilinos+mpi+hypre+superlu-dist+metis+hdf5~mumps~boost', + when='@develop') + + depends_on('pflotran@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('pflotran@develop', when='@develop') + + depends_on('alquimia@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('alquimia@develop', when='@develop') + + depends_on('xsdktrilinos@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('xsdktrilinos@develop', when='@develop') + + variant('debug', default=False, description='Compile in debug mode') + + # How do we propagate debug flag to all depends on packages ? + # If I just do spack install xsdk+debug will that propogate it down? + + # Dummy install for now, will be removed when metapackage is available + def install(self, spec, prefix): + # Prevent the error message + # ==> Error: Install failed for xsdk. Nothing was installed! + # ==> Error: Installation process had nonzero exit code : 256 + with open(os.path.join(spec.prefix, 'bundle-package.txt'), 'w') as out: + out.write('This is a bundle\n') + out.close() diff --git a/var/spack/repos/builtin/packages/xsdktrilinos/package.py b/var/spack/repos/builtin/packages/xsdktrilinos/package.py index 7aea15ed9c..483feb0c96 100644 --- a/var/spack/repos/builtin/packages/xsdktrilinos/package.py +++ b/var/spack/repos/builtin/packages/xsdktrilinos/package.py @@ -35,6 +35,7 @@ class Xsdktrilinos(CMakePackage): base_url = "https://github.com/trilinos/xSDKTrilinos/archive" version('develop', git='https://github.com/trilinos/xSDKTrilinos.git', tag='master') + version('xsdk-0.2.0', git='https://github.com/trilinos/xSDKTrilinos.git', tag='master') version('12.8.1', '9cc338ded17d1e10ea6c0dc18b22dcd4') version('12.6.4', '44c4c54ccbac73bb8939f68797b9454a') @@ -55,7 +56,13 @@ def url_for_version(self, version): # MPI related dependencies depends_on('mpi') + depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre') + depends_on('hypre@develop~internal-superlu', when='@develop+hypre') + depends_on('petsc@xsdk-0.2.0+mpi~complex', when='@xsdk-0.2.0+petsc') + depends_on('petsc@develop+mpi~complex', when='@develop+petsc') depends_on('hypre~internal-superlu', when='+hypre') + depends_on('trilinos@xsdk-0.2.0', when='@xsdk-0.2.0') + depends_on('trilinos@develop', when='@develop') depends_on('petsc+mpi~complex', when='+petsc') depends_on('trilinos@12.6.4', when='@12.6.4') depends_on('trilinos@12.8.1', when='@12.8.1') -- GitLab