QMCPACK Update - Jan 2019 (#10252)

* Add warnings for existing conflicts. New versions of QMCPACK require a compiler with C++14 support.

* QMCPACK now requires a newer release of CMake.

* Switch QMCPACK to using FFTW-api provider.

* Relax dependencies on QMCPACK +da variant.

* Add QMCPACK 3.6.0 release.

* QMCPACK compiler-CUDA conflicts.

* QMCPACK fix typo in expressing conflict.

* Conditional needed since these variables are only used when FFTW is a dependency to QMCPACK.

* QMCPACK QE variant dependency was underspecified. Must include MPI as a hard dependency on QE.

* Update QMCPACK dependencies for HDF5, CMake and Boost.

* QMCPACK clean-up, more consistent use of spec vs. self.spec.

* Add support for collective I/O variant of QMCPACK.

* Update QMCPACK conflicts for QE and PHDF5 variants.

* Use built-in install method for QMCPACK starting with 3.6.0

* QMCPACK compiler C++14 conflicts were off by one version.

* QMCPACK package needs to setup_environment method.

* In support of PR#10252, get rid of slashes in string.

* Migrate these to the CUDA package and make a seperate PR.

* In support of PR#10252, get rid of join_path for nexus.

* In support of PR#10252, work around concretizer limitation.

* In support of PR#10252, convert to conditionals to if-else clauses for compactness.

* In support of PR#10252, get rid of extra space and new line in warning messages.
This commit is contained in:
Nichols A. Romero 2019-01-26 10:13:51 -06:00 committed by Adam J. Stewart
parent a307822fd9
commit 4ab89f4de1

View File

@ -22,6 +22,7 @@ class Qmcpack(CMakePackage):
# can occasionally change.
# NOTE: 12/19/2017 QMCPACK 3.0.0 does not build properly with Spack.
version('develop')
version('3.6.0', tag='v3.6.0')
version('3.5.0', tag='v3.5.0')
version('3.4.0', tag='v3.4.0')
version('3.3.0', tag='v3.3.0')
@ -32,6 +33,7 @@ class Qmcpack(CMakePackage):
# These defaults match those in the QMCPACK manual
variant('debug', default=False, description='Build debug version')
variant('mpi', default=True, description='Build with MPI support')
variant('phdf5', default=True, description='Build with parallel collective I/O')
variant('cuda', default=False,
description='Enable CUDA and GPU acceleration')
variant('complex', default=False,
@ -57,31 +59,70 @@ class Qmcpack(CMakePackage):
# variant('+mixed', default=True, when='+cuda', description="...")
# conflicts
conflicts('+soa', when='+cuda')
conflicts('^openblas+ilp64')
conflicts('^intel-mkl+ilp64')
conflicts(
'+phdf5',
when='~mpi',
msg='Parallel collective I/O requires MPI-enabled QMCPACK. ' \
'Please add "~phdf5" to the Spack install line for serial QMCPACK.'
)
conflicts(
'+qe',
when='~mpi',
msg='QMCPACK QE variant requires MPI due to limitation in QE build ' \
'system. Please add "~qe" to the Spack install line for serial ' \
'QMCPACK.'
)
conflicts(
'+soa',
when='+cuda',
msg='QMCPACK SOA variant does not exist for CUDA'
)
conflicts(
'^openblas+ilp64',
msg='QMCPACK does not support OpenBLAS 64-bit integer variant'
)
conflicts(
'^intel-mkl+ilp64',
msg='QMCPACK does not support MKL 64-bit integer variant'
)
# QMCPACK 3.6.0 or later requires support for C++14
compiler_warning = 'QMCPACK 3.6.0 or later requires a ' \
'compiler with support for C++14'
conflicts('%gcc@:4', when='@3.6.0:', msg=compiler_warning)
conflicts('%intel@:17', when='@3.6.0:', msg=compiler_warning)
conflicts('%pgi@:17', when='@3.6.0:', msg=compiler_warning)
conflicts('%llvm@:3.4', when='@3.6.0:', msg=compiler_warning)
# Dependencies match those in the QMCPACK manual.
# FIXME: once concretizer can unite unconditional and conditional
# dependencies the some of the '~mpi' will not be necessary.
depends_on('cmake@3.4.3:', type='build')
depends_on('mpi', when='+mpi')
depends_on('libxml2')
depends_on('hdf5')
depends_on('hdf5+mpi', when='+mpi')
depends_on('hdf5~mpi', when='~mpi')
# dependencies, some of the '~mpi' variants below will not be necessary.
# Essential libraries
depends_on('cmake@3.4.3:', when='@:3.5.0', type='build')
depends_on('cmake@3.6.0:', when='@3.6.0:', type='build')
depends_on('boost')
depends_on('boost@1.61.0:', when='@3.6.0:')
depends_on('libxml2')
depends_on('mpi', when='+mpi')
depends_on('cuda', when='+cuda')
# HDF5
depends_on('hdf5+hl+fortran', when='+qe')
depends_on('hdf5+hl+fortran+mpi', when='+qe+mpi')
depends_on('hdf5+hl+fortran~mpi', when='+qe~mpi')
depends_on('hdf5~hl~fortran', when='~qe')
depends_on('hdf5~hl~fortran+mpi', when='~qe+mpi')
depends_on('hdf5~hl~fortran~mpi', when='~qe~mpi')
# Math libraries
depends_on('blas')
depends_on('lapack')
depends_on('fftw')
depends_on('fftw+mpi', when='+mpi')
depends_on('fftw~mpi', when='~mpi')
depends_on('cuda', when='+cuda')
depends_on('fftw-api@3')
# qmcpack data analysis tools
# basic command line tool based on Python and NumPy
# blas and lapack patching fails often and so are disabled at this time
depends_on('py-numpy~blas~lapack', when='+da', type='run')
# It may be necesseary to disable the blas and lapack
# when building the 'py-numpy' package, but it should not be a hard
# dependency on the 'py-numpy~blas~lapack' variant
depends_on('py-numpy', when='+da', type='run')
# GUI is optional for data anlysis
# py-matplotlib leads to a long complex DAG for dependencies
@ -93,7 +134,7 @@ class Qmcpack(CMakePackage):
# Spack package
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_qe-6.3.diff'
patch_checksum = '2ee346e24926479f5e96f8dc47812173a8847a58354bbc32cf2114af7a521c13'
depends_on('quantum-espresso@6.3~elpa+hdf5',
depends_on('quantum-espresso@6.3~elpa+mpi+hdf5',
patches=patch(patch_url, sha256=patch_checksum, when='+qe'),
when='+qe+mpi', type='run')
@ -141,10 +182,11 @@ def cmake_args(self):
args.append('-DLibxml2_INCLUDE_DIRS={0}'.format(xml2_prefix.include))
args.append('-DLibxml2_LIBRARY_DIRS={0}'.format(xml2_prefix.lib))
fftw_prefix = spec['fftw'].prefix
args.append('-DFFTW_HOME={0}'.format(fftw_prefix))
args.append('-DFFTW_INCLUDE_DIRS={0}'.format(fftw_prefix.include))
args.append('-DFFTW_LIBRARY_DIRS={0}'.format(fftw_prefix.lib))
if '^fftw@3:' in spec:
fftw_prefix = spec['fftw'].prefix
args.append('-DFFTW_HOME={0}'.format(fftw_prefix))
args.append('-DFFTW_INCLUDE_DIRS={0}'.format(fftw_prefix.include))
args.append('-DFFTW_LIBRARY_DIRS={0}'.format(fftw_prefix.lib))
args.append('-DBOOST_ROOT={0}'.format(self.spec['boost'].prefix))
args.append('-DHDF5_ROOT={0}'.format(self.spec['hdf5'].prefix))
@ -152,13 +194,19 @@ def cmake_args(self):
# Default is MPI, serial version is convenient for cases, e.g. laptops
if '+mpi' in spec:
args.append('-DQMC_MPI=1')
elif '~mpi' in spec:
else:
args.append('-DQMC_MPI=0')
# Default is parallel collective I/O enabled
if '+phdf5' in spec:
args.append('-DENABLE_PHDF5=1')
else:
args.append('-DENABLE_PHDF5=0')
# Default is real-valued single particle orbitals
if '+complex' in spec:
args.append('-DQMC_COMPLEX=1')
elif '~complex' in spec:
else:
args.append('-DQMC_COMPLEX=0')
# When '-DQMC_CUDA=1', CMake automatically sets:
@ -169,13 +217,13 @@ def cmake_args(self):
if '+cuda' in spec:
args.append('-DQMC_CUDA=1')
elif '~cuda' in spec:
else:
args.append('-DQMC_CUDA=0')
# Mixed-precision versues double-precision CPU and GPU code
if '+mixed' in spec:
args.append('-DQMC_MIXED_PRECISION=1')
elif '~mixed' in spec:
else:
args.append('-DQMC_MIXED_PRECISION=0')
# New Structure-of-Array (SOA) code, much faster than default
@ -183,13 +231,13 @@ def cmake_args(self):
# No support for local atomic orbital basis.
if '+soa' in spec:
args.append('-DENABLE_SOA=1')
elif '~soa' in spec:
else:
args.append('-DENABLE_SOA=0')
# Manual Timers
if '+timers' in spec:
args.append('-DENABLE_TIMERS=1')
elif '~timers' in spec:
else:
args.append('-DENABLE_TIMERS=0')
# Proper detection of optimized BLAS and LAPACK.
@ -209,7 +257,7 @@ def cmake_args(self):
# get properly detected. Intel MKL requires special case due to
# differences in Darwin vs. Linux $MKLROOT naming schemes. This section
# of code is intentionally redundant for backwards compatibility.
if 'intel-mkl' in self.spec:
if 'intel-mkl' in spec:
lapack_dir = format(join_path(env['MKLROOT'], 'include'))
# Next two lines were introduced in QMCPACK 3.5.0 and later.
# Prior to v3.5.0, these lines should be benign.
@ -228,6 +276,11 @@ def cmake_args(self):
return args
# 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.
@when('@:3.5.0')
def install(self, spec, prefix):
"""Make the install targets"""
@ -255,6 +308,23 @@ def install(self, spec, prefix):
# install binaries
install_tree('bin', prefix.bin)
# QMCPACK 3.6.0 install directory structure changed, thus there
# thus are two version of the setup_environment method
@when('@:3.5.0')
def setup_environment(self, spack_env, run_env):
"""Set-up runtime environment for QMCPACK.
Set PYTHONPATH for basic analysis scripts and for Nexus."""
run_env.prepend_path('PYTHONPATH', self.prefix.nexus)
@when('@3.6.0:')
def setup_environment(self, spack_env, run_env):
"""Set-up runtime environment for QMCPACK.
Set PYTHONPATH for basic analysis scripts and for Nexus. Binaries
are in the 'prefix' directory instead of 'prefix.bin' which is
not set by the default module environment"""
run_env.prepend_path('PATH', self.prefix)
run_env.prepend_path('PYTHONPATH', self.prefix)
@run_after('build')
@on_package_attributes(run_tests=True)
def check(self):