QMCPACK - General Improvements (#6958)
* No longer need to patch CMake. Using CMAKE_CXX_FLAGS to include BLAS/LAPACK/MKL header files properly. * Backport two patches to QMCPACK versions prior to 3.3.0: https://github.com/QMCPACK/qmcpack/pull/621, https://github.com/QMCPACK/qmcpack/pull/623 * Insufficient to include lapack_dir in CMAKE_CXX_FLAGS, CMAKE_C_FLAGS is also needed. * Make patched Espresso a default variant instead of a hard dependency. This is easier on computer architectures where Espresso is hard to build. * Fix patching with QE variant. Now using correct form of patch command. * Add QMCPACK v3.4.0 * Backport patch to QMCPACK versions prior to 3.3.0: https://github.com/QMCPACK/qmcpack/pull/643
This commit is contained in:
parent
c2a4751237
commit
7db35ff05c
@ -1,55 +0,0 @@
|
|||||||
diff --git a/CMake/FindMKL.cmake b/CMake/FindMKL.cmake
|
|
||||||
index a457eaba0..66dc43ce6 100644
|
|
||||||
--- a/CMake/FindMKL.cmake
|
|
||||||
+++ b/CMake/FindMKL.cmake
|
|
||||||
@@ -7,21 +7,21 @@ FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl.cxx"
|
|
||||||
"#include <iostream>\n #include <mkl.h>\n int main() { return 0; }\n" )
|
|
||||||
try_compile(HAVE_MKL ${CMAKE_BINARY_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl.cxx
|
|
||||||
- CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" )
|
|
||||||
+ CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" "-DINCLUDE_DIRECTORIES=${LAPACK_INCLUDE_DIRS}")
|
|
||||||
|
|
||||||
# Check for mkl_vml_functions.h
|
|
||||||
FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx"
|
|
||||||
"#include <iostream>\n #include <mkl_vml_functions.h>\n int main() { return 0; }\n" )
|
|
||||||
try_compile(HAVE_MKL_VML ${CMAKE_BINARY_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx
|
|
||||||
- CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" )
|
|
||||||
+ CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" "-DINCLUDE_DIRECTORIES=${LAPACK_INCLUDE_DIRS}")
|
|
||||||
|
|
||||||
# Check for fftw3
|
|
||||||
FILE( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_fftw3.cxx"
|
|
||||||
"#include <iostream>\n #include <fftw/fftw3.h>\n int main() { return 0; }\n" )
|
|
||||||
try_compile(HAVE_MKL_FFTW3 ${CMAKE_BINARY_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_fftw3.cxx
|
|
||||||
- CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" )
|
|
||||||
+ CMAKE_FLAGS "${CMAKE_CXX_FLAGS} -mkl" "-DINCLUDE_DIRECTORIES=${LAPACK_INCLUDE_DIRS}")
|
|
||||||
|
|
||||||
IF ( HAVE_MKL )
|
|
||||||
SET( MKL_FOUND 1 )
|
|
||||||
diff --git a/CMake/FindVectorMath.cmake b/CMake/FindVectorMath.cmake
|
|
||||||
index c0c919746..f5c511253 100644
|
|
||||||
--- a/CMake/FindVectorMath.cmake
|
|
||||||
+++ b/CMake/FindVectorMath.cmake
|
|
||||||
@@ -19,7 +19,7 @@ IF ( NOT HAVE_VECTOR_MATH )
|
|
||||||
"#include <iostream>\n #include <mkl_vml_functions.h>\n int main() { return 0; }\n" )
|
|
||||||
try_compile(HAVE_MKL_VML ${CMAKE_BINARY_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src_mkl_vml.cxx
|
|
||||||
- CMAKE_FLAGS "${CMAKE_CXX_FLAGS}" )
|
|
||||||
+ CMAKE_FLAGS "${CMAKE_CXX_FLAGS}" "-DINCLUDE_DIRECTORIES=${LAPACK_INCLUDE_DIRS}")
|
|
||||||
IF (HAVE_MKL_VML)
|
|
||||||
# enable VML only when MKL libraries have been picked up
|
|
||||||
IF (MKL_FOUND)
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 570d8a01f..56d939786 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -464,6 +464,8 @@ ELSE(CMAKE_TOOLCHAIN_FILE)
|
|
||||||
MESSAGE(STATUS "LAPACK libraries: ${LAPACK_LIBRARIES}")
|
|
||||||
MESSAGE(STATUS "LAPACK linker flags: ${LAPACK_LINKER_FLAGS}")
|
|
||||||
SET(LAPACK_LIBRARY ${LAPACK_LIBRARIES} ${LAPACK_LINKER_FLAGS})
|
|
||||||
+ MESSAGE(STATUS "LAPACK_INCLUDE_DIRS: ${LAPACK_INCLUDE_DIRS}")
|
|
||||||
+ INCLUDE_DIRECTORIES(${LAPACK_INCLUDE_DIRS})
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(FATAL_ERROR "Could not find required libraries LAPACK &/or BLAS")
|
|
||||||
ENDIF()
|
|
@ -38,6 +38,7 @@ class Qmcpack(CMakePackage):
|
|||||||
# Spack manual. However, it is easier to maintain because github hashes
|
# Spack manual. However, it is easier to maintain because github hashes
|
||||||
# can occasionally change.
|
# can occasionally change.
|
||||||
# NOTE: 12/19/2017 QMCPACK 3.0.0 does not build properly with Spack.
|
# NOTE: 12/19/2017 QMCPACK 3.0.0 does not build properly with Spack.
|
||||||
|
version('3.4.0', git=url, tag='v3.4.0')
|
||||||
version('3.3.0', git=url, tag='v3.3.0')
|
version('3.3.0', git=url, tag='v3.3.0')
|
||||||
version('3.2.0', git=url, tag='v3.2.0')
|
version('3.2.0', git=url, tag='v3.2.0')
|
||||||
version('3.1.1', git=url, tag='v3.1.1')
|
version('3.1.1', git=url, tag='v3.1.1')
|
||||||
@ -64,6 +65,8 @@ class Qmcpack(CMakePackage):
|
|||||||
description='Install with support for basic data analysis tools')
|
description='Install with support for basic data analysis tools')
|
||||||
variant('gui', default=False,
|
variant('gui', default=False,
|
||||||
description='Install with Matplotlib (long installation time)')
|
description='Install with Matplotlib (long installation time)')
|
||||||
|
variant('qe', default=True,
|
||||||
|
description='Install with patched Quantum Espresso 5.3.0')
|
||||||
|
|
||||||
# cuda variant implies mixed precision variant by default, but there is
|
# cuda variant implies mixed precision variant by default, but there is
|
||||||
# no way to express this in variant syntax, need something like
|
# no way to express this in variant syntax, need something like
|
||||||
@ -105,16 +108,28 @@ class Qmcpack(CMakePackage):
|
|||||||
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_espresso-5.3.0.diff'
|
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_espresso-5.3.0.diff'
|
||||||
patch_checksum = '0d8d7ba805313ddd4c02ee32c96d2f12e7091e9e82e22671d3ad5a24247860c4'
|
patch_checksum = '0d8d7ba805313ddd4c02ee32c96d2f12e7091e9e82e22671d3ad5a24247860c4'
|
||||||
depends_on('espresso@5.3.0~elpa',
|
depends_on('espresso@5.3.0~elpa',
|
||||||
patches=patch(patch_url, sha256=patch_checksum),
|
patches=patch(patch_url, sha256=patch_checksum, when='+qe'),
|
||||||
when='+mpi')
|
when='+qe+mpi')
|
||||||
|
|
||||||
depends_on('espresso@5.3.0~elpa~scalapack~mpi',
|
depends_on('espresso@5.3.0~elpa~scalapack~mpi',
|
||||||
patches=patch(patch_url, sha256=patch_checksum),
|
patches=patch(patch_url, sha256=patch_checksum, when='+qe'),
|
||||||
when='~mpi')
|
when='+qe~mpi')
|
||||||
|
|
||||||
# This is Spack specific patch, we may need to enhance QMCPACK's CMake
|
# Backport several patches from recent versions of QMCPACK
|
||||||
# in the near future.
|
# The test_numerics unit test is broken prior to QMCPACK 3.3.0
|
||||||
patch('cmake.diff')
|
patch_url = 'https://patch-diff.githubusercontent.com/raw/QMCPACK/qmcpack/pull/621.patch'
|
||||||
|
patch_checksum = 'e2ff7a6f0f006856085d4aab6d31f32f16353e41f760a33a7ef75f3ecce6a5d6'
|
||||||
|
patch(patch_url, sha256=patch_checksum, when='@3.1.0:3.3.0')
|
||||||
|
|
||||||
|
# FindMKL.cmake has an issues prior to QMCPACK 3.3.0
|
||||||
|
patch_url = 'https://patch-diff.githubusercontent.com/raw/QMCPACK/qmcpack/pull/623.patch'
|
||||||
|
patch_checksum = '3eb9dec05fd1a544318ff84cd8b5926cfc6b46b375c7f3b012ccf0b50cf617b7'
|
||||||
|
patch(patch_url, sha256=patch_checksum, when='@3.1.0:3.3.0')
|
||||||
|
|
||||||
|
# git-rev files for not git builds issues prior to QMCPACK 3.3.0
|
||||||
|
patch_url = 'https://patch-diff.githubusercontent.com/raw/QMCPACK/qmcpack/pull/643.patch'
|
||||||
|
patch_checksum = 'c066c79901a612cf8848135e0d544efb114534cca70b90bfccc8ed989d3d9dde'
|
||||||
|
patch(patch_url, sha256=patch_checksum, when='@3.1.0:3.3.0')
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
# FindLibxml2QMC.cmake doesn't check the environment by default
|
# FindLibxml2QMC.cmake doesn't check the environment by default
|
||||||
@ -207,14 +222,18 @@ def cmake_args(self):
|
|||||||
# header files. Intel MKL requires special case due to differences in
|
# header files. Intel MKL requires special case due to differences in
|
||||||
# Darwin vs. Linux $MKLROOT naming schemes
|
# Darwin vs. Linux $MKLROOT naming schemes
|
||||||
if 'intel-mkl' in self.spec:
|
if 'intel-mkl' in self.spec:
|
||||||
args.append(
|
lapack_dir = format(join_path(env['MKLROOT'], 'include'))
|
||||||
'-DLAPACK_INCLUDE_DIRS=%s' %
|
|
||||||
format(join_path(env['MKLROOT'], 'include')))
|
|
||||||
else:
|
else:
|
||||||
args.append(
|
lapack_dir = ':'.join((
|
||||||
'-DLAPACK_INCLUDE_DIRS=%s;%s' % (
|
spec['lapack'].prefix.include,
|
||||||
self.spec['lapack'].prefix.include,
|
spec['blas'].prefix.include
|
||||||
self.spec['blas'].prefix.include))
|
))
|
||||||
|
|
||||||
|
args.extend([
|
||||||
|
'-DCMAKE_CXX_FLAGS=-I%s' % lapack_dir,
|
||||||
|
'-DCMAKE_C_FLAGS=-I%s' % lapack_dir
|
||||||
|
])
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
Loading…
Reference in New Issue
Block a user