diff options
author | Nichols A. Romero <naromero77@users.noreply.github.com> | 2019-05-02 21:13:19 -0500 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2019-05-03 11:13:19 +0900 |
commit | 42b01c02b14aa609e6b0ffdde31a10389fc9cf53 (patch) | |
tree | f511b765679d4068698ad0881444c48cc693d9db /var/spack/repos/builtin/packages/qmcpack/package.py | |
parent | 54c19ce16cbe7d096d14e13f036b65f4534eb1c5 (diff) | |
download | spack-42b01c02b14aa609e6b0ffdde31a10389fc9cf53.tar.gz spack-42b01c02b14aa609e6b0ffdde31a10389fc9cf53.tar.bz2 spack-42b01c02b14aa609e6b0ffdde31a10389fc9cf53.tar.xz spack-42b01c02b14aa609e6b0ffdde31a10389fc9cf53.zip |
QMCPACK: compiler flags and mpi wrapper updates (#11326)
* Set mpi compiler wrappers using CC/etc. variables as recommended
at https://spack.readthedocs.io/en/latest/packaging_guide.html#compiler-wrappers
rather than setting CMake variables like -DCMAKE_C_COMPILER
* Use convenience functionality provided by inherited CMakePackage to
export all compiler flags as CMake options
Diffstat (limited to 'var/spack/repos/builtin/packages/qmcpack/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/qmcpack/package.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/var/spack/repos/builtin/packages/qmcpack/package.py b/var/spack/repos/builtin/packages/qmcpack/package.py index fdf3ab1539..2a9f30cc23 100644 --- a/var/spack/repos/builtin/packages/qmcpack/package.py +++ b/var/spack/repos/builtin/packages/qmcpack/package.py @@ -169,6 +169,8 @@ class Qmcpack(CMakePackage, CudaPackage): patch_checksum = 'c066c79901a612cf8848135e0d544efb114534cca70b90bfccc8ed989d3d9dde' patch(patch_url, sha256=patch_checksum, when='@3.1.0:3.3.0') + flag_handler = CMakePackage.build_system_flags + def patch(self): # FindLibxml2QMC.cmake doesn't check the environment by default # for libxml2, so we fix that. @@ -180,16 +182,6 @@ class Qmcpack(CMakePackage, CudaPackage): spec = self.spec args = [] - # This bit of code is needed in order to pass compiler.yaml flags - # into the QMCPACK's CMake. Probably the CMake base class in - # the code of Spack should be doing this instead. Otherwise, it - # it would need to be done on a per package basis which is - # problematic. - cflags = spec.compiler_flags['cflags'] - cxxflags = spec.compiler_flags['cxxflags'] - args.append('-DCMAKE_C_FLAGS=%s' % ' '.join(cflags)) - args.append('-DCMAKE_CXX_FLAGS=%s' % ' '.join(cxxflags)) - # This issue appears specifically with the the Intel compiler, # but may be an issue with other compilers as well. The final fix # probably needs to go into QMCPACK's CMake instead of in Spack. @@ -200,12 +192,6 @@ class Qmcpack(CMakePackage, CudaPackage): if '%intel' in spec: args.append('-DQMC_EXTRA_LIBS=-lifcore') - if '+mpi' in spec: - mpi = spec['mpi'] - args.append('-DCMAKE_C_COMPILER={0}'.format(mpi.mpicc)) - args.append('-DCMAKE_CXX_COMPILER={0}'.format(mpi.mpicxx)) - args.append('-DMPI_BASE_DIR:PATH={0}'.format(mpi.prefix)) - # Currently FFTW_HOME and LIBXML2_HOME are used by CMake. # Any CMake warnings about other variables are benign. xml2_prefix = spec['libxml2'].prefix @@ -318,10 +304,27 @@ class Qmcpack(CMakePackage, CudaPackage): # QMCPACK 3.6.0 release and later has a functional 'make install', # the Spack 'def install' is retained for backwards compatiblity. # Note that the two install methods differ in their directory - # structure. + # structure. Additionally, we follow the recommendation on the Spack + # website for defining the compilers to be the MPI compiler wrappers. + # https://spack.readthedocs.io/en/latest/packaging_guide.html#compiler-wrappers + @when('@3.6.0:') + def install(self, spec, prefix): + if '+mpi' in spec: + env['CC'] = spec['mpi'].mpicc + env['CXX'] = spec['mpi'].mpicxx + env['F77'] = spec['mpi'].mpif77 + env['FC'] = spec['mpi'].mpifc + + with working_dir(self.build_directory): + make('install') + @when('@:3.5.0') def install(self, spec, prefix): - """Make the install targets""" + if '+mpi' in spec: + env['CC'] = spec['mpi'].mpicc + env['CXX'] = spec['mpi'].mpicxx + env['F77'] = spec['mpi'].mpif77 + env['FC'] = spec['mpi'].mpifc # QMCPACK 'make install' does nothing, which causes # Spack to throw an error. |