diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2017-03-02 19:01:29 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-03-02 10:01:29 -0800 |
commit | ed582cef68585b6090866fb0bb3aa2cc72dbe2ed (patch) | |
tree | a2ae4def802cc244ce38044974c34d64e669b675 /var | |
parent | 5ce926d2d16d7ecd5aae72f586caba74cf07862d (diff) | |
download | spack-ed582cef68585b6090866fb0bb3aa2cc72dbe2ed.tar.gz spack-ed582cef68585b6090866fb0bb3aa2cc72dbe2ed.tar.bz2 spack-ed582cef68585b6090866fb0bb3aa2cc72dbe2ed.tar.xz spack-ed582cef68585b6090866fb0bb3aa2cc72dbe2ed.zip |
New interface for passing build information among specs (#1875)
- Added a new interface for Specs to pass build information
- Calls forwarded from Spec to Package are now explicit
- Added descriptor within Spec to manage forwarding
- Added state in Spec to maintain query information
- Modified a few packages (the one involved in spack install pexsi) to showcase changes
- This uses an object wrapper to `spec` to implement the `libs` sub-calls.
- wrapper is returned from `__getitem__` only if spec is concrete
- allows packagers to access build information easily
Diffstat (limited to 'var')
40 files changed, 104 insertions, 107 deletions
diff --git a/var/spack/repos/builtin.mock/packages/mpileaks/package.py b/var/spack/repos/builtin.mock/packages/mpileaks/package.py index 749fcc601a..c84fdf2238 100644 --- a/var/spack/repos/builtin.mock/packages/mpileaks/package.py +++ b/var/spack/repos/builtin.mock/packages/mpileaks/package.py @@ -42,6 +42,9 @@ class Mpileaks(Package): depends_on("mpi") depends_on("callpath") + # Will be used to try raising an exception + libs = None + def install(self, spec, prefix): pass diff --git a/var/spack/repos/builtin/packages/abinit/package.py b/var/spack/repos/builtin/packages/abinit/package.py index ff27f69723..1798059ee7 100644 --- a/var/spack/repos/builtin/packages/abinit/package.py +++ b/var/spack/repos/builtin/packages/abinit/package.py @@ -127,13 +127,13 @@ class Abinit(Package): # BLAS/LAPACK if '+scalapack' in spec: oapp("--with-linalg-flavor=custom+scalapack") - linalg = (spec['scalapack'].scalapack_libs + - spec['lapack'].lapack_libs + spec['blas'].blas_libs) + linalg = (spec['scalapack'].libs + + spec['lapack'].libs + spec['blas'].libs) # elif '+elpa' in spec: else: oapp("--with-linalg-flavor=custom") - linalg = spec['lapack'].lapack_libs + spec['blas'].blas_libs + linalg = spec['lapack'].libs + spec['blas'].libs oapp("--with-linalg-libs=%s" % linalg.ld_flags) diff --git a/var/spack/repos/builtin/packages/armadillo/package.py b/var/spack/repos/builtin/packages/armadillo/package.py index 2336da4520..9ab1b66880 100644 --- a/var/spack/repos/builtin/packages/armadillo/package.py +++ b/var/spack/repos/builtin/packages/armadillo/package.py @@ -55,9 +55,9 @@ class Armadillo(Package): # ARPACK support '-DARPACK_LIBRARY={0}'.format(arpack.joined()), # BLAS support - '-DBLAS_LIBRARY={0}'.format(spec['blas'].blas_libs.joined()), + '-DBLAS_LIBRARY={0}'.format(spec['blas'].libs.joined()), # LAPACK support - '-DLAPACK_LIBRARY={0}'.format(spec['lapack'].lapack_libs.joined()), + '-DLAPACK_LIBRARY={0}'.format(spec['lapack'].libs.joined()), # SuperLU support '-DSuperLU_INCLUDE_DIR={0}'.format(spec['superlu'].prefix.include), '-DSuperLU_LIBRARY={0}'.format(superlu.joined()), diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py index a1c18d8086..1168d4623c 100644 --- a/var/spack/repos/builtin/packages/arpack-ng/package.py +++ b/var/spack/repos/builtin/packages/arpack-ng/package.py @@ -88,8 +88,8 @@ class ArpackNg(Package): options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix) # Make sure we use Spack's blas/lapack: - lapack_libs = spec['lapack'].lapack_libs.joined(';') - blas_libs = spec['blas'].blas_libs.joined(';') + lapack_libs = spec['lapack'].libs.joined(';') + blas_libs = spec['blas'].libs.joined(';') options.extend([ '-DLAPACK_FOUND=true', @@ -129,8 +129,8 @@ class ArpackNg(Package): ]) options.extend([ - '--with-blas={0}'.format(spec['blas'].blas_libs.ld_flags), - '--with-lapack={0}'.format(spec['lapack'].lapack_libs.ld_flags) + '--with-blas={0}'.format(spec['blas'].libs.ld_flags), + '--with-lapack={0}'.format(spec['lapack'].libs.ld_flags) ]) if '+shared' not in spec: options.append('--enable-shared=no') diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 51f0fced2b..b62d39dde8 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -112,8 +112,7 @@ class Atlas(Package): make("install") self.install_test() - @property - def blas_libs(self): + def libs(self): # libsatlas.[so,dylib,dll ] contains all serial APIs (serial lapack, # serial BLAS), and all ATLAS symbols needed to support them. Whereas # libtatlas.[so,dylib,dll ] is parallel (multithreaded) version. @@ -135,10 +134,6 @@ class Atlas(Package): to_find, root=self.prefix, shared=shared, recurse=True ) - @property - def lapack_libs(self): - return self.blas_libs - def install_test(self): source_file = join_path(os.path.dirname(self.module.__file__), 'test_cblas_dgemm.c') @@ -146,7 +141,7 @@ class Atlas(Package): 'test_cblas_dgemm.output') include_flags = ["-I%s" % self.spec.prefix.include] - link_flags = self.lapack_libs.ld_flags.split() + link_flags = self.libs.ld_flags.split() output = compile_c_and_execute(source_file, include_flags, link_flags) compare_output_file(output, blessed_file) diff --git a/var/spack/repos/builtin/packages/atompaw/package.py b/var/spack/repos/builtin/packages/atompaw/package.py index 17d0ef8209..987eb86e30 100644 --- a/var/spack/repos/builtin/packages/atompaw/package.py +++ b/var/spack/repos/builtin/packages/atompaw/package.py @@ -49,7 +49,7 @@ class Atompaw(Package): def install(self, spec, prefix): options = ['--prefix=%s' % prefix] - linalg = spec['lapack'].lapack_libs + spec['blas'].blas_libs + linalg = spec['lapack'].libs + spec['blas'].libs options.extend([ "--with-linalg-libs=%s" % linalg.ld_flags, "--enable-libxc", diff --git a/var/spack/repos/builtin/packages/cantera/package.py b/var/spack/repos/builtin/packages/cantera/package.py index 5cd9fcdd17..fece11380d 100644 --- a/var/spack/repos/builtin/packages/cantera/package.py +++ b/var/spack/repos/builtin/packages/cantera/package.py @@ -85,7 +85,7 @@ class Cantera(Package): # BLAS/LAPACK support if '+lapack' in spec: - lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs + lapack_blas = spec['lapack'].libs + spec['blas'].libs options.extend([ 'blas_lapack_libs={0}'.format(','.join(lapack_blas.names)), 'blas_lapack_dir={0}'.format(spec['lapack'].prefix.lib) diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 3a175ea1a2..9bf7a5bc6b 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -88,12 +88,10 @@ class Cp2k(Package): cppflags = [ '-D__FFTW3', '-D__LIBINT', - '-I' + spec['fftw'].prefix.include + spec['fftw'].cppflags ] fcflags = copy.deepcopy(optflags[self.spec.compiler.name]) - fcflags.extend([ - '-I' + spec['fftw'].prefix.include - ]) + fcflags.append(spec['fftw'].cppflags) fftw = find_libraries(['libfftw3'], root=spec['fftw'].prefix.lib) ldflags = [fftw.search_flags] libs = [ @@ -154,15 +152,17 @@ class Cp2k(Package): '-D__SCALAPACK' ]) fcflags.extend([ + # spec['elpa:fortran'].cppflags '-I' + join_path( spec['elpa'].prefix, 'include', 'elpa-{0}'.format(str(spec['elpa'].version)), 'modules' ), + # spec[pexsi:fortran].cppflags '-I' + join_path(spec['pexsi'].prefix, 'fortran') ]) - scalapack = spec['scalapack'].scalapack_libs + scalapack = spec['scalapack'].libs ldflags.append(scalapack.search_flags) libs.extend([ join_path(spec['elpa'].prefix.lib, @@ -184,8 +184,8 @@ class Cp2k(Package): libs.extend(self.spec['mpi'].mpicxx_shared_libs) libs.extend(self.compiler.stdcxx_libs) # LAPACK / BLAS - lapack = spec['lapack'].lapack_libs - blas = spec['blas'].blas_libs + lapack = spec['lapack'].libs + blas = spec['blas'].libs ldflags.append((lapack + blas).search_flags) libs.extend([str(x) for x in (fftw, lapack, blas)]) diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 22fb168e65..61dae81a3d 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -145,7 +145,7 @@ class Dealii(CMakePackage): options = [] cxx_flags = [] - lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs + lapack_blas = spec['lapack'].libs + spec['blas'].libs options.extend([ '-DDEAL_II_COMPONENT_EXAMPLES=ON', '-DDEAL_II_WITH_THREADS:BOOL=ON', diff --git a/var/spack/repos/builtin/packages/elk/package.py b/var/spack/repos/builtin/packages/elk/package.py index acaf863935..148fbd999a 100644 --- a/var/spack/repos/builtin/packages/elk/package.py +++ b/var/spack/repos/builtin/packages/elk/package.py @@ -90,9 +90,9 @@ class Elk(Package): blas = 'blas.a' lapack = 'lapack.a' if '+blas' in spec: - blas = spec['blas'].blas_libs.joined() + blas = spec['blas'].libs.joined() if '+lapack' in spec: - lapack = spec['lapack'].lapack_libs.joined() + lapack = spec['lapack'].libs.joined() # lapack must come before blas config['LIB_LPK'] = ' '.join([lapack, blas]) diff --git a/var/spack/repos/builtin/packages/elpa/package.py b/var/spack/repos/builtin/packages/elpa/package.py index b433bf40b0..fe249269c7 100644 --- a/var/spack/repos/builtin/packages/elpa/package.py +++ b/var/spack/repos/builtin/packages/elpa/package.py @@ -59,16 +59,16 @@ class Elpa(Package): 'FC={0}'.format(self.spec['mpi'].mpifc), 'CXX={0}'.format(self.spec['mpi'].mpicxx), 'FCFLAGS={0}'.format( - spec['lapack'].lapack_libs.joined() + spec['lapack'].libs.joined() ), 'LDFLAGS={0}'.format( - spec['lapack'].lapack_libs.joined() + spec['lapack'].libs.joined() ), 'SCALAPACK_FCFLAGS={0}'.format( - spec['scalapack'].scalapack_libs.joined() + spec['scalapack'].libs.joined() ), 'SCALAPACK_LDFLAGS={0}'.format( - spec['scalapack'].scalapack_libs.joined() + spec['scalapack'].libs.joined() ), '--prefix={0}'.format(self.prefix) ] diff --git a/var/spack/repos/builtin/packages/gmsh/package.py b/var/spack/repos/builtin/packages/gmsh/package.py index 5c42fcf39f..54ff17e387 100644 --- a/var/spack/repos/builtin/packages/gmsh/package.py +++ b/var/spack/repos/builtin/packages/gmsh/package.py @@ -88,7 +88,7 @@ class Gmsh(CMakePackage): options.append('-DENABLE_OS_SPECIFIC_INSTALL=OFF') # Make sure GMSH picks up correct BlasLapack by providing linker flags - blas_lapack = spec['lapack'].lapack_libs + spec['blas'].blas_libs + blas_lapack = spec['lapack'].libs + spec['blas'].libs options.append( '-DBLAS_LAPACK_LIBRARIES={0}'.format(blas_lapack.ld_flags)) diff --git a/var/spack/repos/builtin/packages/hpl/package.py b/var/spack/repos/builtin/packages/hpl/package.py index fa0013de17..a171408a26 100644 --- a/var/spack/repos/builtin/packages/hpl/package.py +++ b/var/spack/repos/builtin/packages/hpl/package.py @@ -78,7 +78,7 @@ class Hpl(Package): 'MPlib = -L{0}'.format(spec['mpi'].prefix.lib), # Linear Algebra library (BLAS or VSIPL) 'LAinc = {0}'.format(spec['blas'].prefix.include), - 'LAlib = {0}'.format(spec['blas'].blas_libs.joined()), + 'LAlib = {0}'.format(spec['blas'].libs.joined()), # F77 / C interface 'F2CDEFS = -DAdd_ -DF77_INTEGER=int -DStringSunStyle', # HPL includes / libraries / specifics diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index 14a2a5cc0c..0c6ee732b7 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -62,8 +62,8 @@ class Hypre(Package): os.environ['F77'] = spec['mpi'].mpif77 # Note: --with-(lapack|blas)_libs= needs space separated list of names - lapack = spec['lapack'].lapack_libs - blas = spec['blas'].blas_libs + lapack = spec['lapack'].libs + blas = spec['blas'].libs configure_args = [ '--prefix=%s' % prefix, diff --git a/var/spack/repos/builtin/packages/intel-mkl/package.py b/var/spack/repos/builtin/packages/intel-mkl/package.py index eb3ce37c37..6bd4689bc1 100644 --- a/var/spack/repos/builtin/packages/intel-mkl/package.py +++ b/var/spack/repos/builtin/packages/intel-mkl/package.py @@ -83,7 +83,7 @@ class IntelMkl(IntelInstaller): @property def lapack_libs(self): - return self.blas_libs + return self.libs @property def scalapack_libs(self): diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py index 287f2bb76e..afaed8b5ed 100644 --- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py +++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py @@ -127,7 +127,7 @@ class IntelParallelStudio(IntelInstaller): @property def lapack_libs(self): - return self.blas_libs + return self.libs @property def scalapack_libs(self): diff --git a/var/spack/repos/builtin/packages/ipopt/package.py b/var/spack/repos/builtin/packages/ipopt/package.py index bd1e5f36ef..1aa8e807c4 100644 --- a/var/spack/repos/builtin/packages/ipopt/package.py +++ b/var/spack/repos/builtin/packages/ipopt/package.py @@ -53,8 +53,8 @@ class Ipopt(Package): mumps_flags = "-ldmumps -lmumps_common -lpord -lmpiseq" mumps_libcmd = "-L%s " % mumps_dir.lib + mumps_flags - blas_lib = spec['blas'].blas_libs.ld_flags - lapack_lib = spec['lapack'].lapack_libs.ld_flags + blas_lib = spec['blas'].libs.ld_flags + lapack_lib = spec['lapack'].libs.ld_flags configure_args = [ "--prefix=%s" % prefix, diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py index 45f64cef65..a25583e164 100644 --- a/var/spack/repos/builtin/packages/mfem/package.py +++ b/var/spack/repos/builtin/packages/mfem/package.py @@ -102,7 +102,7 @@ class Mfem(Package): options = ['PREFIX=%s' % prefix] if '+lapack' in spec: - lapack_lib = (spec['lapack'].lapack_libs + spec['blas'].blas_libs).ld_flags # NOQA: ignore=E501 + lapack_lib = (spec['lapack'].libs + spec['blas'].libs).ld_flags # NOQA: ignore=E501 options.extend([ 'MFEM_USE_LAPACK=YES', 'LAPACK_OPT=-I%s' % spec['lapack'].prefix.include, diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index 9fd5b5f36b..01469b1f0f 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -82,8 +82,8 @@ class Mumps(Package): raise RuntimeError( 'You cannot use the variants parmetis or ptscotch without mpi') - lapack_blas = (self.spec['lapack'].lapack_libs + - self.spec['blas'].blas_libs) + lapack_blas = (self.spec['lapack'].libs + + self.spec['blas'].libs) makefile_conf = ["LIBBLAS = %s" % lapack_blas.ld_flags] orderings = ['-Dpord'] @@ -156,7 +156,7 @@ class Mumps(Package): 'OPTC = %s -O ' % fpic]) if '+mpi' in self.spec: - scalapack = self.spec['scalapack'].scalapack_libs + scalapack = self.spec['scalapack'].libs makefile_conf.extend( ['CC = {0}'.format(self.spec['mpi'].mpicc), 'FC = {0}'.format(self.spec['mpi'].mpifc), diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py index ee011e7d1b..9d0ebae371 100644 --- a/var/spack/repos/builtin/packages/netlib-lapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py @@ -113,7 +113,7 @@ class NetlibLapack(Package): if '+external-blas' in spec: cmake_args.extend([ '-DUSE_OPTIMIZED_BLAS:BOOL=ON', - '-DBLAS_LIBRARIES:PATH=%s' % spec['blas'].blas_libs.joined(';') + '-DBLAS_LIBRARIES:PATH=%s' % spec['blas'].libs.joined(';') ]) cmake_args.extend(std_cmake_args) diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py index 578d2d8988..7d8b803abf 100644 --- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py @@ -74,8 +74,8 @@ class NetlibScalapack(Package): ] # Make sure we use Spack's Lapack: - blas = spec['blas'].blas_libs - lapack = spec['lapack'].lapack_libs + blas = spec['blas'].libs + lapack = spec['lapack'].libs options.extend([ '-DLAPACK_FOUND=true', '-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include, diff --git a/var/spack/repos/builtin/packages/nwchem/package.py b/var/spack/repos/builtin/packages/nwchem/package.py index 556dba34c2..f39d8ad0c7 100644 --- a/var/spack/repos/builtin/packages/nwchem/package.py +++ b/var/spack/repos/builtin/packages/nwchem/package.py @@ -73,9 +73,9 @@ class Nwchem(Package): patch(url, when=condition, level=0, md5=md5) def install(self, spec, prefix): - scalapack = spec['scalapack'].scalapack_libs - lapack = spec['lapack'].lapack_libs - blas = spec['blas'].blas_libs + scalapack = spec['scalapack'].libs + lapack = spec['lapack'].libs + blas = spec['blas'].libs # see http://www.nwchem-sw.org/index.php/Compiling_NWChem args = [] args.extend([ diff --git a/var/spack/repos/builtin/packages/octave/package.py b/var/spack/repos/builtin/packages/octave/package.py index 731e2a630f..fe6ea8ce68 100644 --- a/var/spack/repos/builtin/packages/octave/package.py +++ b/var/spack/repos/builtin/packages/octave/package.py @@ -108,8 +108,8 @@ class Octave(AutotoolsPackage): # Required dependencies config_args.extend([ - "--with-blas=%s" % spec['blas'].blas_libs.ld_flags, - "--with-lapack=%s" % spec['lapack'].lapack_libs.ld_flags + "--with-blas=%s" % spec['blas'].libs.ld_flags, + "--with-lapack=%s" % spec['lapack'].libs.ld_flags ]) # Strongly recommended dependencies diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py index b74befbe35..81e4543745 100644 --- a/var/spack/repos/builtin/packages/octopus/package.py +++ b/var/spack/repos/builtin/packages/octopus/package.py @@ -71,8 +71,8 @@ class Octopus(Package): def install(self, spec, prefix): arpack = find_libraries(['libarpack'], root=spec[ 'arpack-ng'].prefix.lib, shared=True) - lapack = spec['lapack'].lapack_libs - blas = spec['blas'].blas_libs + lapack = spec['lapack'].libs + blas = spec['blas'].libs args = [] args.extend([ '--prefix=%s' % prefix, @@ -105,8 +105,8 @@ class Octopus(Package): ]) if '+scalapack' in spec: args.extend([ - '--with-blacs=%s' % spec['scalapack'].scalapack_libs, - '--with-scalapack=%s' % spec['scalapack'].scalapack_libs, + '--with-blacs=%s' % spec['scalapack'].libs, + '--with-scalapack=%s' % spec['scalapack'].libs, ]) # --with-etsf-io-prefix= # --with-sparskit=${prefix}/lib/libskit.a diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 3909744dc8..5648e58b02 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -59,17 +59,6 @@ class Openblas(MakefilePackage): parallel = False - @property - def blas_libs(self): - shared = True if '+shared' in self.spec else False - return find_libraries( - ['libopenblas'], root=self.prefix, shared=shared, recurse=True - ) - - @property - def lapack_libs(self): - return self.blas_libs - @run_before('edit') def check_compilers(self): # As of 06/2016 there is no mechanism to specify that packages which @@ -151,13 +140,15 @@ class Openblas(MakefilePackage): blessed_file = join_path(os.path.dirname(self.module.__file__), 'test_cblas_dgemm.output') - include_flags = ["-I%s" % join_path(spec.prefix, "include")] - link_flags = self.lapack_libs.ld_flags.split() + include_flags = spec.cppflags + link_flags = spec.libs.ld_flags if self.compiler.name == 'intel': - link_flags.extend(["-lifcore"]) - link_flags.extend(["-lpthread"]) + link_flags += ' -lifcore' + link_flags += ' -lpthread' if '+openmp' in spec: - link_flags.extend([self.compiler.openmp_flag]) + link_flags += ' ' + self.compiler.openmp_flag - output = compile_c_and_execute(source_file, include_flags, link_flags) + output = compile_c_and_execute( + source_file, [include_flags], link_flags.split() + ) compare_output_file(output, blessed_file) diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 562ef22a09..4d09676fac 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -116,6 +116,18 @@ class Openmpi(AutotoolsPackage): return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % ( version.up_to(2), version) + @property + def libs(self): + query_parameters = self.spec.last_query.extra_parameters + libraries = ['libmpi'] + + if 'cxx' in query_parameters: + libraries = ['libmpi_cxx'] + libraries + + return find_libraries( + libraries, root=self.prefix, shared=True, recurse=True + ) + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): spack_env.set('MPICC', join_path(self.prefix.bin, 'mpicc')) spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpic++')) diff --git a/var/spack/repos/builtin/packages/opium/package.py b/var/spack/repos/builtin/packages/opium/package.py index 521f917230..4c50bcfaf2 100644 --- a/var/spack/repos/builtin/packages/opium/package.py +++ b/var/spack/repos/builtin/packages/opium/package.py @@ -37,7 +37,7 @@ class Opium(Package): depends_on('lapack') def install(self, spec, prefix): - libs = spec['lapack'].lapack_libs + spec['blas'].blas_libs + libs = spec['lapack'].libs + spec['blas'].libs options = ['LDFLAGS=%s' % libs.ld_flags] configure(*options) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index a9d4ff6065..3e670cba63 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -161,7 +161,7 @@ class Petsc(Package): ]) # Make sure we use exactly the same Blas/Lapack libraries # across the DAG. To that end list them explicitly - lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs + lapack_blas = spec['lapack'].libs + spec['blas'].libs options.extend([ '--with-blas-lapack-lib=%s' % lapack_blas.joined() ]) diff --git a/var/spack/repos/builtin/packages/pexsi/make.inc b/var/spack/repos/builtin/packages/pexsi/make.inc index a8020fb370..c97b09b424 100644 --- a/var/spack/repos/builtin/packages/pexsi/make.inc +++ b/var/spack/repos/builtin/packages/pexsi/make.inc @@ -36,7 +36,7 @@ DSUPERLU_INCLUDE = -I${DSUPERLU_DIR}/include INCLUDES = ${PEXSI_INCLUDE} ${DSUPERLU_INCLUDE} # Libraries -CPP_LIB = @STDCXX_LIB @MPICXX_LIB +CPP_LIB = @MPICXX_LIB @STDCXX_LIB #GFORTRAN_LIB = /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a LAPACK_LIB = @LAPACK_LIBS BLAS_LIB = @BLAS_LIBS diff --git a/var/spack/repos/builtin/packages/pexsi/package.py b/var/spack/repos/builtin/packages/pexsi/package.py index 9fc71d4c52..989e2ebf6e 100644 --- a/var/spack/repos/builtin/packages/pexsi/package.py +++ b/var/spack/repos/builtin/packages/pexsi/package.py @@ -59,7 +59,7 @@ class Pexsi(Package): '@MPICC': self.spec['mpi'].mpicc, '@MPICXX': self.spec['mpi'].mpicxx, '@MPIFC': self.spec['mpi'].mpifc, - '@MPICXX_LIB': ' '.join(self.spec['mpi'].mpicxx_shared_libs), + '@MPICXX_LIB': self.spec['mpi:cxx'].libs.joined(), '@RANLIB': 'ranlib', '@PEXSI_STAGE': self.stage.source_path, '@SUPERLU_PREFIX': self.spec['superlu-dist'].prefix, @@ -67,8 +67,9 @@ class Pexsi(Package): '@PARMETIS_PREFIX': self.spec['parmetis'].prefix, '@LAPACK_PREFIX': self.spec['lapack'].prefix, '@BLAS_PREFIX': self.spec['blas'].prefix, - '@LAPACK_LIBS': self.spec['lapack'].lapack_libs.joined(), - '@BLAS_LIBS': self.spec['lapack'].blas_libs.joined(), + '@LAPACK_LIBS': self.spec['lapack'].libs.joined(), + '@BLAS_LIBS': self.spec['blas'].libs.joined(), + # FIXME : what to do with compiler provided libraries ? '@STDCXX_LIB': ' '.join(self.compiler.stdcxx_libs) } diff --git a/var/spack/repos/builtin/packages/psi4/package.py b/var/spack/repos/builtin/packages/psi4/package.py index 4248c24646..d14aff363b 100644 --- a/var/spack/repos/builtin/packages/psi4/package.py +++ b/var/spack/repos/builtin/packages/psi4/package.py @@ -62,10 +62,10 @@ class Psi4(Package): def install(self, spec, prefix): cmake_args = [ '-DBLAS_TYPE={0}'.format(spec['blas'].name.upper()), - '-DBLAS_LIBRARIES={0}'.format(spec['blas'].blas_libs.joined()), + '-DBLAS_LIBRARIES={0}'.format(spec['blas'].libs.joined()), '-DLAPACK_TYPE={0}'.format(spec['lapack'].name.upper()), '-DLAPACK_LIBRARIES={0}'.format( - spec['lapack'].lapack_libs.joined()), + spec['lapack'].libs.joined()), '-DBOOST_INCLUDEDIR={0}'.format(spec['boost'].prefix.include), '-DBOOST_LIBRARYDIR={0}'.format(spec['boost'].prefix.lib), '-DENABLE_CHEMPS2=OFF' diff --git a/var/spack/repos/builtin/packages/py-numpy/package.py b/var/spack/repos/builtin/packages/py-numpy/package.py index a1aedb730c..11f6ebb1a5 100644 --- a/var/spack/repos/builtin/packages/py-numpy/package.py +++ b/var/spack/repos/builtin/packages/py-numpy/package.py @@ -70,10 +70,10 @@ class PyNumpy(PythonPackage): # for build notes see http://www.scipy.org/scipylib/building/linux.html lapackblas = LibraryList('') if '+lapack' in spec: - lapackblas += spec['lapack'].lapack_libs + lapackblas += spec['lapack'].libs if '+blas' in spec: - lapackblas += spec['blas'].blas_libs + lapackblas += spec['blas'].libs if '+blas' in spec or '+lapack' in spec: # note that one should not use [blas_opt] and [lapack_opt], see diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py index 740e490b5a..122032e131 100644 --- a/var/spack/repos/builtin/packages/suite-sparse/package.py +++ b/var/spack/repos/builtin/packages/suite-sparse/package.py @@ -101,8 +101,8 @@ class SuiteSparse(Package): # Make sure Spack's Blas/Lapack is used. Otherwise System's # Blas/Lapack might be picked up. - blas = spec['blas'].blas_libs.ld_flags - lapack = spec['lapack'].lapack_libs.ld_flags + blas = spec['blas'].libs.ld_flags + lapack = spec['lapack'].libs.ld_flags if '@4.5.1' in spec: # adding -lstdc++ is clearly an ugly way to do this, but it follows # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py index 6ee247b7ea..cb12a410f4 100644 --- a/var/spack/repos/builtin/packages/sundials/package.py +++ b/var/spack/repos/builtin/packages/sundials/package.py @@ -80,8 +80,8 @@ class Sundials(Package): cmake_args.extend([ '-DLAPACK_ENABLE=ON', '-DLAPACK_LIBRARIES={0}'.format( - (spec['lapack'].lapack_libs + - spec['blas'].blas_libs).joined(';') + (spec['lapack'].libs + + spec['blas'].libs).joined(';') ) ]) else: diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py index f076358e90..802c7abc37 100644 --- a/var/spack/repos/builtin/packages/superlu-dist/package.py +++ b/var/spack/repos/builtin/packages/superlu-dist/package.py @@ -53,7 +53,7 @@ class SuperluDist(Package): depends_on('metis@5:') def install(self, spec, prefix): - lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs + lapack_blas = spec['lapack'].libs + spec['blas'].libs makefile_inc = [] makefile_inc.extend([ 'PLAT = _mac_x', @@ -61,17 +61,17 @@ class SuperluDist(Package): 'DSUPERLULIB = $(DSuperLUroot)/lib/libsuperlu_dist.a', 'BLASDEF = -DUSE_VENDOR_BLAS', 'BLASLIB = %s' % lapack_blas.ld_flags, - 'METISLIB = -L%s -lmetis' % spec['metis'].prefix.lib, - 'PARMETISLIB = -L%s -lparmetis' % spec['parmetis'].prefix.lib, + 'METISLIB = %s' % spec['metis'].libs.ld_flags, + 'PARMETISLIB = %s' % spec['parmetis'].libs.ld_flags, 'FLIBS =', 'LIBS = $(DSUPERLULIB) $(BLASLIB) $(PARMETISLIB) $(METISLIB)', # noqa 'ARCH = ar', 'ARCHFLAGS = cr', 'RANLIB = true', 'CC = {0}'.format(self.spec['mpi'].mpicc), - 'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s %s' % ( - spec['parmetis'].prefix.include, - spec['metis'].prefix.include, + 'CFLAGS = -fPIC -std=c99 -O2 %s %s %s' % ( + spec['parmetis'].cppflags, + spec['metis'].cppflags, '-D_LONGINT' if '+int64' in spec else ''), 'NOOPTS = -fPIC -std=c99', 'FORTRAN = {0}'.format(self.spec['mpi'].mpif77), diff --git a/var/spack/repos/builtin/packages/superlu-mt/package.py b/var/spack/repos/builtin/packages/superlu-mt/package.py index ea94c2d4c5..fd6091a0f0 100644 --- a/var/spack/repos/builtin/packages/superlu-mt/package.py +++ b/var/spack/repos/builtin/packages/superlu-mt/package.py @@ -86,7 +86,7 @@ class SuperluMt(Package): if '+blas' in spec: config.extend([ 'BLASDEF = -DUSE_VENDOR_BLAS', - 'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags) + 'BLASLIB = {0}'.format(spec['blas'].libs.ld_flags) ]) else: config.append('BLASLIB = ../lib/libblas$(PLAT).a') diff --git a/var/spack/repos/builtin/packages/superlu/package.py b/var/spack/repos/builtin/packages/superlu/package.py index 829949e504..13c11b66b9 100644 --- a/var/spack/repos/builtin/packages/superlu/package.py +++ b/var/spack/repos/builtin/packages/superlu/package.py @@ -48,7 +48,7 @@ class Superlu(Package): def install(self, spec, prefix): cmake_args = [ '-Denable_blaslib=OFF', - '-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_libs.joined()) + '-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].libs.joined()) ] if '+fpic' in spec: @@ -76,7 +76,7 @@ class Superlu(Package): 'SUPERLULIB = $(SuperLUroot)/lib/libsuperlu_{0}.a' \ .format(self.spec.version), 'BLASDEF = -DUSE_VENDOR_BLAS', - 'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags), + 'BLASLIB = {0}'.format(spec['blas'].libs.ld_flags), # or BLASLIB = -L/usr/lib64 -lblas 'TMGLIB = libtmglib.a', 'LIBS = $(SUPERLULIB) $(BLASLIB)', diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index a4d97a6bc7..6cf1032f83 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -147,8 +147,8 @@ class Trilinos(CMakePackage): mpi_bin = spec['mpi'].prefix.bin # Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names - blas = spec['blas'].blas_libs - lapack = spec['lapack'].lapack_libs + blas = spec['blas'].libs + lapack = spec['lapack'].libs options.extend([ '-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=ON', '-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON', diff --git a/var/spack/repos/builtin/packages/veclibfort/package.py b/var/spack/repos/builtin/packages/veclibfort/package.py index b906d4f9c9..fa99acfa97 100644 --- a/var/spack/repos/builtin/packages/veclibfort/package.py +++ b/var/spack/repos/builtin/packages/veclibfort/package.py @@ -44,17 +44,12 @@ class Veclibfort(Package): provides('blas') provides('lapack') - @property - def blas_libs(self): + def libs(self): shared = True if '+shared' in self.spec else False return find_libraries( ['libvecLibFort'], root=self.prefix, shared=shared, recurse=True ) - @property - def lapack_libs(self): - return self.blas_libs - def install(self, spec, prefix): if sys.platform != 'darwin': raise InstallError('vecLibFort can be installed on macOS only') @@ -65,6 +60,6 @@ class Veclibfort(Package): # test fc = which('fc') flags = ['-o', 'tester', '-O', 'tester.f90'] - flags.extend(self.lapack_libs.ld_flags.split()) + flags.extend(spec.libs.ld_flags.split()) fc(*flags) Executable('./tester')() diff --git a/var/spack/repos/builtin/packages/wannier90/package.py b/var/spack/repos/builtin/packages/wannier90/package.py index 119d2cf769..ad61860d73 100644 --- a/var/spack/repos/builtin/packages/wannier90/package.py +++ b/var/spack/repos/builtin/packages/wannier90/package.py @@ -47,8 +47,8 @@ class Wannier90(Package): def install(self, spec, prefix): - lapack = self.spec['lapack'].lapack_libs - blas = self.spec['blas'].blas_libs + lapack = self.spec['lapack'].libs + blas = self.spec['blas'].libs substitutions = { '@F90': spack_fc, '@MPIF90': self.spec['mpi'].mpifc, |