mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-27 21:55:16 -04:00
Attempt to fix CMake and toolchain behavior regarding LibXS path (#5365)
Co-authored-by: Taillefumier Mathieu <29380261+mtaillefumier@users.noreply.github.com> Co-authored-by: Hans Pabst <hans.pabst@intel.com>
This commit is contained in:
parent
9dda3dd524
commit
85b8a9b49c
35 changed files with 479 additions and 611 deletions
117
CMakeLists.txt
117
CMakeLists.txt
|
|
@ -137,6 +137,9 @@ option(CP2K_USE_OPENPMD "Enable support for I/O via openPMD" OFF)
|
|||
option(CP2K_USE_LIBXC "Enable LibXC support" ${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_GAUXC "Enable GauXC support" ${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_MPI "Enable MPI support" ${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_LIBXS
|
||||
"Enable LIBXS support; required if OpenCL backend enabled"
|
||||
${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_PEXSI "Enable PEXSI support" ${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_SPGLIB "Enable Spglib support" ${CP2K_USE_EVERYTHING})
|
||||
option(CP2K_USE_TREXIO "Enable TREXIO support" ${CP2K_USE_EVERYTHING})
|
||||
|
|
@ -170,7 +173,10 @@ cmake_dependent_option(CP2K_USE_SPLA "Enable SpLA support"
|
|||
${CP2K_USE_EVERYTHING} "CP2K_USE_MPI" OFF)
|
||||
cmake_dependent_option(CP2K_USE_MIMIC "Enable MIMIC support"
|
||||
${CP2K_USE_EVERYTHING} "CP2K_USE_MPI" OFF)
|
||||
option(CP2K_USE_LIBXS "Enable libxs support" ON)
|
||||
|
||||
cmake_dependent_option(CP2K_USE_LIBXSMM "Enable LIBXSMM JIT-kernel for LIBXS"
|
||||
${CP2K_USE_EVERYTHING} "CP2K_USE_LIBXS" OFF)
|
||||
|
||||
cmake_dependent_option(CP2K_USE_LIBVDWXC "Enable libvdwxc support with SIRIUS"
|
||||
${CP2K_USE_EVERYTHING} "CP2K_USE_SIRIUS" OFF)
|
||||
|
||||
|
|
@ -466,14 +472,14 @@ if(CP2K_USE_DBCSR_CONFIG)
|
|||
)
|
||||
endif()
|
||||
else()
|
||||
find_package(DBCSR 2.6 REQUIRED)
|
||||
find_package(DBCSR 2.8 REQUIRED)
|
||||
endif()
|
||||
|
||||
# SMM (Small Matrix-Matrix multiplication)
|
||||
if(CP2K_USE_LIBXS)
|
||||
find_package(LIBXS REQUIRED)
|
||||
find_package(LIBXSMM)
|
||||
if(LIBXSMM_FOUND)
|
||||
find_package(libxs REQUIRED)
|
||||
if(CP2K_USE_LIBXSMM)
|
||||
find_package(libxsmm CONFIG REQUIRED)
|
||||
message(STATUS "Using LIBXS + LIBXSMM for Small Matrix Multiplication")
|
||||
else()
|
||||
message(STATUS "Using LIBXS for Small Matrix Multiplication")
|
||||
|
|
@ -653,7 +659,9 @@ find_package(OpenMP REQUIRED COMPONENTS Fortran C CXX)
|
|||
# Discover OpenCL backend via LIBXSTREAM.
|
||||
if(CP2K_USE_ACCEL MATCHES "OPENCL")
|
||||
if(NOT CP2K_USE_LIBXS)
|
||||
message(FATAL_ERROR "OpenCL backend requires LIBXS (CP2K_USE_LIBXS=ON).")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"CP2K_USE_LIBXS is not set but LIBXS is required for OpenCL backend.")
|
||||
endif()
|
||||
message("\n------------------------------------------------------------")
|
||||
message("- OPENCL -")
|
||||
|
|
@ -666,66 +674,20 @@ if(CP2K_USE_ACCEL MATCHES "OPENCL")
|
|||
list(APPEND CMAKE_PREFIX_PATH "$ENV{CUDA_PATH}")
|
||||
endif()
|
||||
find_package(OpenCL REQUIRED)
|
||||
find_package(libxstream REQUIRED)
|
||||
message(STATUS "Using LIBXSTREAM for the OpenCL backend")
|
||||
|
||||
# Locate LIBXSTREAM: user override > DBCSR hint > pkg-config > path probing
|
||||
set(LIBXSTREAMROOT
|
||||
""
|
||||
CACHE PATH "Root directory of LIBXSTREAM")
|
||||
if(NOT LIBXSTREAMROOT AND DBCSR_LIBXSTREAMROOT)
|
||||
set(LIBXSTREAMROOT "${DBCSR_LIBXSTREAMROOT}")
|
||||
endif()
|
||||
if(NOT LIBXSTREAMROOT AND PkgConfig_FOUND)
|
||||
pkg_check_modules(_LIBXSTREAM QUIET libxstream)
|
||||
if(_LIBXSTREAM_FOUND)
|
||||
pkg_get_variable(LIBXSTREAMROOT libxstream prefix)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT LIBXSTREAMROOT)
|
||||
foreach(_dir "${CMAKE_SOURCE_DIR}/../libxstream" "$ENV{HOME}/libxstream")
|
||||
if(EXISTS "${_dir}/include/libxstream.h")
|
||||
set(LIBXSTREAMROOT "${_dir}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT LIBXSTREAMROOT OR NOT EXISTS "${LIBXSTREAMROOT}/include/libxstream.h")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"LIBXSTREAMROOT not found. Set -DLIBXSTREAMROOT=/path/to/libxstream")
|
||||
endif()
|
||||
message(STATUS "Using LIBXSTREAM from ${LIBXSTREAMROOT}")
|
||||
set(_libxstream_suffixes_save ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so .dylib)
|
||||
unset(CP2K_OPENCL_BACKEND CACHE)
|
||||
if(EXISTS "${LIBXSTREAM_INCLUDE_DIRS}/libxstream/opencl")
|
||||
set(CP2K_OPENCL_BACKEND "${LIBXSTREAM_INCLUDE_DIRS}/libxstream")
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
find_library(
|
||||
CP2K_LIBXSTREAM_LIBRARY xstream
|
||||
PATHS "${LIBXSTREAMROOT}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT CP2K_LIBXSTREAM_LIBRARY)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxstream_suffixes_save})
|
||||
find_library(
|
||||
CP2K_LIBXSTREAM_LIBRARY xstream
|
||||
PATHS "${LIBXSTREAMROOT}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxstream_suffixes_save})
|
||||
if(NOT CP2K_LIBXSTREAM_LIBRARY)
|
||||
message(FATAL_ERROR "libxstream library not found in ${LIBXSTREAMROOT}/lib")
|
||||
endif()
|
||||
|
||||
set(CP2K_OPENCL_BACKEND "${LIBXSTREAMROOT}/include")
|
||||
set(CP2K_OPENCL_SCRIPT "${LIBXSTREAMROOT}/scripts/tool_opencl.sh")
|
||||
if(EXISTS ${CP2K_OPENCL_SCRIPT})
|
||||
set(CP2K_OPENCL_COMMON
|
||||
"${LIBXSTREAMROOT}/include/opencl/libxstream_atomics.h")
|
||||
set(CP2K_USE_OPENCL ON)
|
||||
message(STATUS "OpenCL backend found")
|
||||
else()
|
||||
message(FATAL_ERROR "OpenCL backend not found (${CP2K_OPENCL_SCRIPT})")
|
||||
set(CP2K_OPENCL_BACKEND "${LIBXSTREAM_INCLUDE_DIRS}")
|
||||
endif()
|
||||
set(CP2K_OPENCL_SAMPLES "${LIBXSTREAM_SMM_DIR}")
|
||||
set(CP2K_OPENCL_SCRIPT "${LIBXSTREAM_OPENCL_SCRIPT}")
|
||||
set(CP2K_OPENCL_COMMON "${LIBXSTREAM_OPENCL_SCRIPT}")
|
||||
set(CP2K_USE_OPENCL ON)
|
||||
message(STATUS "OpenCL backend found")
|
||||
endif()
|
||||
|
||||
message("\n------------------------------------------------------------")
|
||||
|
|
@ -737,24 +699,7 @@ if(CP2K_USE_ELPA)
|
|||
endif()
|
||||
|
||||
if(CP2K_USE_LIBXC)
|
||||
find_package(Libxc 7 QUIET CONFIG)
|
||||
if(NOT Libxc_FOUND AND PkgConfig_FOUND)
|
||||
pkg_check_modules(CP2K_LIBXCF03 QUIET IMPORTED_TARGET GLOBAL libxcf03>=7)
|
||||
if(NOT CP2K_LIBXCF03_FOUND)
|
||||
pkg_check_modules(CP2K_LIBXCF03 REQUIRED IMPORTED_TARGET GLOBAL libxc>=7)
|
||||
endif()
|
||||
pkg_check_modules(CP2K_LIBXC QUIET IMPORTED_TARGET GLOBAL libxc>=7)
|
||||
if(NOT TARGET Libxc::xcf03)
|
||||
add_library(Libxc::xcf03 INTERFACE IMPORTED)
|
||||
target_link_libraries(
|
||||
Libxc::xcf03
|
||||
INTERFACE PkgConfig::CP2K_LIBXCF03
|
||||
$<$<BOOL:${CP2K_LIBXC_FOUND}>:PkgConfig::CP2K_LIBXC>)
|
||||
endif()
|
||||
elseif(NOT Libxc_FOUND)
|
||||
message(
|
||||
FATAL_ERROR "LibXC >= 7 not found (tried CMake config and pkg-config)")
|
||||
endif()
|
||||
find_package(Libxc 7 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(CP2K_USE_GAUXC)
|
||||
|
|
@ -826,6 +771,8 @@ if(CP2K_USE_DLAF)
|
|||
"${CP2K_DLAF_FORTRAN_LIBRARY}" DIRECTORY)
|
||||
get_filename_component(CP2K_DLAF_FORTRAN_PREFIX
|
||||
"${CP2K_DLAF_FORTRAN_PREFIX}" DIRECTORY)
|
||||
# we will need to fix this issue later because it requires small
|
||||
# modifications of the dlaf build system. It should not be hardcoded.
|
||||
if(EXISTS "${CP2K_DLAF_FORTRAN_PREFIX}/include/dlaf_fortran.mod")
|
||||
list(APPEND CP2K_DLAF_INCLUDE_DIRS
|
||||
"${CP2K_DLAF_FORTRAN_PREFIX}/include")
|
||||
|
|
@ -955,10 +902,6 @@ if(CP2K_USE_ACE)
|
|||
endif()
|
||||
|
||||
if(CP2K_USE_TBLITE)
|
||||
find_package(mctc-lib REQUIRED)
|
||||
find_package(toml-f REQUIRED)
|
||||
find_package(dftd4 REQUIRED)
|
||||
find_package(s-dftd3 REQUIRED)
|
||||
find_package(tblite REQUIRED)
|
||||
add_library(cp2k::tblite INTERFACE IMPORTED)
|
||||
target_link_libraries(
|
||||
|
|
@ -1390,6 +1333,10 @@ if(NOT CP2K_USE_LIBXS)
|
|||
message(" - LIBXS")
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_USE_LIBXSMM)
|
||||
message(" - LIBXSMM")
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_USE_LIBINT2)
|
||||
message(" - Libint2")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -38,9 +38,20 @@ if(NOT TARGET cp2k::cp2k)
|
|||
|
||||
find_dependency(DBCSR 2.8 REQUIRED)
|
||||
|
||||
if (@CP2K_USE_LIBXSMM@)
|
||||
set(CP2K_USE_LIBXSMM @CP2K_USE_LIBXSMM@)
|
||||
find_dependency(libxsmm REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBXS@)
|
||||
set(CP2K_USE_LIBXS @CP2K_USE_LIBXS@)
|
||||
find_dependency(LIBXS REQUIRED)
|
||||
find_dependency(libxs REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_OPENCL@)
|
||||
set(CP2K_USE_OPENCL @CP2K_USE_OPENCL@)
|
||||
find_dependency(OpenCL REQUIRED)
|
||||
find_dependency(libxstream REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_HIP@)
|
||||
|
|
|
|||
|
|
@ -1,96 +0,0 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(cp2k_utils)
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
cp2k_set_default_paths(LIBXS "LIBXS")
|
||||
|
||||
# Path probing: DBCSR hint > sibling of source > $HOME > /opt
|
||||
if(CP2K_LIBXS_ROOT STREQUAL "/usr")
|
||||
if(DBCSR_LIBXSROOT AND EXISTS "${DBCSR_LIBXSROOT}/include/libxs.h")
|
||||
set(CP2K_LIBXS_ROOT "${DBCSR_LIBXSROOT}")
|
||||
else()
|
||||
foreach(_dir "${CMAKE_SOURCE_DIR}/../libxs" "$ENV{HOME}/libxs" "/opt/libxs")
|
||||
if(EXISTS "${_dir}/include/libxs.h")
|
||||
set(CP2K_LIBXS_ROOT "${_dir}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
pkg_check_modules(CP2K_LIBXS IMPORTED_TARGET GLOBAL libxs-shared)
|
||||
else()
|
||||
pkg_check_modules(CP2K_LIBXS IMPORTED_TARGET GLOBAL libxs-static)
|
||||
endif()
|
||||
if(NOT CP2K_LIBXS_FOUND)
|
||||
pkg_check_modules(CP2K_LIBXS IMPORTED_TARGET GLOBAL libxs)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_LIBXS_FOUND)
|
||||
set(_libxs_suffixes_save ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so .dylib)
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
cp2k_find_libraries(LIBXS xs)
|
||||
if(NOT CP2K_LIBXS_FOUND)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxs_suffixes_save})
|
||||
cp2k_find_libraries(LIBXS xs)
|
||||
endif()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxs_suffixes_save})
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_LIBXS_INCLUDE_DIRS)
|
||||
cp2k_include_dirs(LIBXS "libxs.h;include/libxs.h")
|
||||
endif()
|
||||
|
||||
if(CP2K_LIBXS_INCLUDE_DIRS)
|
||||
find_package_handle_standard_args(LIBXS DEFAULT_MSG CP2K_LIBXS_INCLUDE_DIRS
|
||||
CP2K_LIBXS_LINK_LIBRARIES)
|
||||
else()
|
||||
find_package_handle_standard_args(LIBXS DEFAULT_MSG CP2K_LIBXS_LINK_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET cp2k::LIBXS::libxs)
|
||||
add_library(cp2k::LIBXS::libxs INTERFACE IMPORTED)
|
||||
if(CP2K_LIBXS_FOUND)
|
||||
if(CP2K_LIBXS_LIBRARY_DIRS)
|
||||
target_link_directories(cp2k::LIBXS::libxs INTERFACE
|
||||
${CP2K_LIBXS_LIBRARY_DIRS})
|
||||
endif()
|
||||
set_target_properties(
|
||||
cp2k::LIBXS::libxs PROPERTIES INTERFACE_LINK_LIBRARIES
|
||||
"${CP2K_LIBXS_LINK_LIBRARIES}")
|
||||
if(CP2K_LIBXS_INCLUDE_DIRS)
|
||||
if(CP2K_LIBXS_PREFIX)
|
||||
set_target_properties(
|
||||
cp2k::LIBXS::libxs
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${CP2K_LIBXS_INCLUDE_DIRS};${CP2K_LIBXS_PREFIX}/include")
|
||||
else()
|
||||
set_target_properties(
|
||||
cp2k::LIBXS::libxs PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${CP2K_LIBXS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET cp2k::LIBXS)
|
||||
add_library(cp2k::LIBXS INTERFACE IMPORTED)
|
||||
target_link_libraries(cp2k::LIBXS INTERFACE cp2k::LIBXS::libxs)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_LIBXS_INCLUDE_DIRS CP2K_LIBXS_LIBRARY_DIRS
|
||||
CP2K_LIBXS_LINK_LIBRARIES)
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# Probe: user override > DBCSR hint > sibling of LIBXS > environment > common
|
||||
# paths
|
||||
if(NOT LIBXSMMROOT)
|
||||
foreach(_dir
|
||||
"${DBCSR_LIBXSMMROOT}" "$ENV{LIBXSMMROOT}" "${LIBXSROOT}/../libxsmm"
|
||||
"${CMAKE_SOURCE_DIR}/../libxsmm" "$ENV{HOME}/libxsmm")
|
||||
if(EXISTS "${_dir}/include/libxsmm.h")
|
||||
set(LIBXSMMROOT "${_dir}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(LIBXSMMROOT)
|
||||
find_path(
|
||||
CP2K_LIBXSMM_INCLUDE_DIR libxsmm.h
|
||||
PATHS "${LIBXSMMROOT}/include"
|
||||
NO_DEFAULT_PATH)
|
||||
set(_libxsmm_suffixes_save ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so .dylib)
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
find_library(
|
||||
CP2K_LIBXSMM_LIBRARY xsmm
|
||||
PATHS "${LIBXSMMROOT}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT CP2K_LIBXSMM_LIBRARY)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxsmm_suffixes_save})
|
||||
find_library(
|
||||
CP2K_LIBXSMM_LIBRARY xsmm
|
||||
PATHS "${LIBXSMMROOT}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_libxsmm_suffixes_save})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(LIBXSMM DEFAULT_MSG CP2K_LIBXSMM_INCLUDE_DIR
|
||||
CP2K_LIBXSMM_LIBRARY)
|
||||
|
||||
if(LIBXSMM_FOUND AND NOT TARGET cp2k::LIBXSMM)
|
||||
add_library(cp2k::LIBXSMM UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
cp2k::LIBXSMM
|
||||
PROPERTIES IMPORTED_LOCATION "${CP2K_LIBXSMM_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CP2K_LIBXSMM_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_LIBXSMM_INCLUDE_DIR CP2K_LIBXSMM_LIBRARY)
|
||||
|
|
@ -1551,7 +1551,7 @@ if(CP2K_USE_CUDA
|
|||
"${CMAKE_CURRENT_BINARY_DIR}/${CP2K_DBM_OPENCL_KERNEL}.h")
|
||||
add_custom_command(
|
||||
COMMAND
|
||||
${CP2K_OPENCL_SCRIPT} -b 6 -p \"\" -I "${LIBXSTREAMROOT}/include"
|
||||
${CP2K_OPENCL_SCRIPT} -b 6 -p \"\" -I "${CP2K_OPENCL_BACKEND}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${CP2K_DBM_OPENCL_KERNEL}
|
||||
"${CP2K_DBM_OPENCL_GENHDR}"
|
||||
DEPENDS ${CP2K_OPENCL_SCRIPT} ${CP2K_OPENCL_COMMON}
|
||||
|
|
@ -1561,8 +1561,10 @@ if(CP2K_USE_CUDA
|
|||
add_custom_target(cp2k_dbm_opencl_kernel
|
||||
DEPENDS "${CP2K_DBM_OPENCL_GENHDR}")
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/dbm)
|
||||
include_directories(${LIBXSTREAMROOT}/include)
|
||||
include_directories(${LIBXSTREAMROOT}/samples)
|
||||
include_directories(${CP2K_OPENCL_BACKEND})
|
||||
if(CP2K_OPENCL_SAMPLES)
|
||||
include_directories(${CP2K_OPENCL_SAMPLES})
|
||||
endif()
|
||||
list(APPEND CP2K_DBM_SRCS_C dbm/dbm_multiply_opencl.c)
|
||||
else()
|
||||
list(APPEND CP2K_SRCS_GPU ${CP2K_DBM_SRCS_GPU})
|
||||
|
|
@ -1634,10 +1636,10 @@ add_library(cp2k_linalg_libs INTERFACE)
|
|||
target_link_libraries(
|
||||
cp2k_linalg_libs
|
||||
INTERFACE cp2k::LAPACK::lapack
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:cp2k::LIBXS::libxs>
|
||||
$<$<BOOL:${LIBXSMM_FOUND}>:cp2k::LIBXSMM>
|
||||
$<$<BOOL:${CP2K_USE_OPENCL}>:${CP2K_LIBXSTREAM_LIBRARY}>
|
||||
$<$<BOOL:${CP2K_USE_OPENCL}>:OpenCL::OpenCL>
|
||||
$<$<BOOL:${CP2K_USE_OPENCL}>:libxstream::libxstream>
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:libxs::libxs>
|
||||
$<$<BOOL:${CP2K_USE_LIBXSMM}>:libxsmm::libxsmm>
|
||||
cp2k::BLAS::blas
|
||||
$<$<BOOL:${CP2K_USE_CUDA}>:cp2k_cuda_libs>
|
||||
$<$<BOOL:${CP2K_USE_HIP}>:cp2k_hip_libs>
|
||||
|
|
@ -1729,7 +1731,9 @@ elseif(CP2K_USE_ACCEL MATCHES "HIP")
|
|||
"${CMAKE_HIP_ARCHITECTURES}")
|
||||
elseif(CP2K_USE_ACCEL MATCHES "OPENCL")
|
||||
include_directories(${CP2K_OPENCL_BACKEND})
|
||||
include_directories(${LIBXSTREAMROOT}/samples)
|
||||
if(CP2K_OPENCL_SAMPLES)
|
||||
include_directories(${CP2K_OPENCL_SAMPLES})
|
||||
endif()
|
||||
include_directories(${OpenCL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
|
|
@ -1849,7 +1853,6 @@ target_compile_definitions(
|
|||
$<$<BOOL:${CP2K_USE_COSMA}>:__COSMA>
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:__LIBXS>
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:__BLAS>
|
||||
$<$<BOOL:${LIBXSMM_FOUND}>:__LIBXSMM>
|
||||
$<$<BOOL:${CP2K_USE_LIBXSMM}>:__LIBXSMM>
|
||||
$<$<BOOL:${CP2K_USE_OPENCL}>:__LIBXSTREAM>
|
||||
$<$<BOOL:${CP2K_USE_SIRIUS_DFTD3}>:__SIRIUS_DFTD3>
|
||||
|
|
@ -1883,6 +1886,16 @@ endif()
|
|||
|
||||
add_library(cp2k::cp2k ALIAS cp2k)
|
||||
|
||||
if(CP2K_USE_LIBXS)
|
||||
message(STATUS "Adding libxs_jit.F from dependency libxs for compilation")
|
||||
get_target_property(_libxs_incdirs libxs::libxs INTERFACE_INCLUDE_DIRECTORIES)
|
||||
find_path(CP2K_LIBXS_JIT_DIR "libxs_jit.F" HINTS ${_libxs_incdirs})
|
||||
if(CP2K_LIBXS_JIT_DIR)
|
||||
target_sources(cp2k PRIVATE "${CP2K_LIBXS_JIT_DIR}/libxs_jit.F")
|
||||
endif()
|
||||
unset(_libxs_incdirs)
|
||||
endif()
|
||||
|
||||
# ##############################################################################
|
||||
# applications
|
||||
# ##############################################################################
|
||||
|
|
@ -1973,7 +1986,7 @@ target_compile_definitions(
|
|||
dbm_miniapp
|
||||
PRIVATE $<$<BOOL:${CP2K_USE_LIBXS}>:__LIBXS>
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:__BLAS>
|
||||
$<$<BOOL:${LIBXSMM_FOUND}>:__LIBXSMM>
|
||||
$<$<BOOL:${CP2K_USE_LIBXSMM}>:__LIBXSMM>
|
||||
$<$<STREQUAL:"${CP2K_BLAS_VENDOR}","MKL">:__MKL>)
|
||||
|
||||
if(CP2K_DISABLE_DBM_GPU)
|
||||
|
|
@ -1995,7 +2008,7 @@ foreach(__app grid_miniapp grid_unittest)
|
|||
${__app}
|
||||
PRIVATE $<$<BOOL:${CP2K_USE_LIBXS}>:__LIBXS>
|
||||
$<$<BOOL:${CP2K_USE_LIBXS}>:__BLAS>
|
||||
$<$<BOOL:${LIBXSMM_FOUND}>:__LIBXSMM>
|
||||
$<$<BOOL:${CP2K_USE_LIBXSMM}>:__LIBXSMM>
|
||||
$<$<STREQUAL:"${CP2K_BLAS_VENDOR}","MKL">:__MKL>)
|
||||
|
||||
if(CP2K_DISABLE_GRID_GPU)
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@ MODULE ai_contraction_sphi
|
|||
|
||||
USE kinds, ONLY: dp, int_8
|
||||
#if defined(__LIBXS)
|
||||
USE LIBXS, ONLY: libxs_gemm_config_t, libxs_gemm_dispatch, &
|
||||
libxs_gemm_call, LIBXS_DATATYPE_F64
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LOC, C_FUNLOC
|
||||
USE LIBXS_JIT, ONLY: libxs_gemm_config_t, libxs_gemm_dispatch, &
|
||||
libxs_gemm_call, LIBXS_DATATYPE_F64, C_LOC
|
||||
#endif
|
||||
|
||||
#include "../base/base_uses.f90"
|
||||
|
|
@ -265,47 +264,6 @@ CONTAINS
|
|||
#if defined(__LIBXS)
|
||||
TYPE(libxs_gemm_config_t) :: cfg1, cfg2
|
||||
INTEGER :: rc1, rc2
|
||||
#if defined(__MKL)
|
||||
INTERFACE
|
||||
FUNCTION mkl_cblas_jit_create_dgemm(jitter, &
|
||||
layout, transa, transb, m, n, k, &
|
||||
alpha, lda, ldb, beta, ldc) &
|
||||
RESULT(status) BIND(C)
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_INT, C_DOUBLE
|
||||
INTEGER(C_INT) :: status
|
||||
TYPE(C_PTR) :: jitter
|
||||
INTEGER(C_INT), VALUE :: layout, transa, transb
|
||||
INTEGER(C_INT), VALUE :: m, n, k, lda, ldb, ldc
|
||||
REAL(C_DOUBLE), VALUE :: alpha, beta
|
||||
END FUNCTION
|
||||
FUNCTION mkl_jit_get_dgemm_ptr(jitter) RESULT(ptr) BIND(C)
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_FUNPTR, C_PTR
|
||||
TYPE(C_FUNPTR) :: ptr
|
||||
TYPE(C_PTR), INTENT(IN), VALUE :: jitter
|
||||
END FUNCTION
|
||||
END INTERFACE
|
||||
#endif
|
||||
#if defined(__LIBXSMM)
|
||||
INTERFACE
|
||||
FUNCTION libxsmm_dispatch_gemm(shape, flags, prefetch) &
|
||||
RESULT(fn) BIND(C)
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_FUNPTR, C_INT
|
||||
INTEGER(C_INT), INTENT(IN) :: shape(10)
|
||||
INTEGER(C_INT), INTENT(IN), VALUE :: flags, prefetch
|
||||
TYPE(C_FUNPTR) :: fn
|
||||
END FUNCTION
|
||||
END INTERFACE
|
||||
#endif
|
||||
INTERFACE
|
||||
SUBROUTINE dgemm_blas(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) &
|
||||
BIND(C, NAME="dgemm_")
|
||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT, C_CHAR, C_DOUBLE
|
||||
CHARACTER(1, C_CHAR), INTENT(IN) :: transa, transb
|
||||
INTEGER(C_INT), INTENT(IN) :: m, n, k, lda, ldb, ldc
|
||||
REAL(C_DOUBLE), INTENT(IN) :: alpha, beta, a(*), b(*)
|
||||
REAL(C_DOUBLE), INTENT(INOUT) :: c(*)
|
||||
END SUBROUTINE
|
||||
END INTERFACE
|
||||
#endif
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
|
@ -343,46 +301,14 @@ CONTAINS
|
|||
#if defined(__LIBXS)
|
||||
IF (ab_first) THEN
|
||||
rc1 = libxs_gemm_dispatch(cfg1, LIBXS_DATATYPE_F64, 'N', 'N', &
|
||||
nsgfa, ncob, ncoa, nsgfa, ncoa, nsgfa, 1.0D0, 0.0D0 &
|
||||
#if defined(__MKL)
|
||||
, jit_create_dgemm=C_FUNLOC(mkl_cblas_jit_create_dgemm) &
|
||||
, jit_get_dgemm=C_FUNLOC(mkl_jit_get_dgemm_ptr) &
|
||||
#endif
|
||||
#if defined(__LIBXSMM)
|
||||
, xgemm_dispatch=C_FUNLOC(libxsmm_dispatch_gemm) &
|
||||
#endif
|
||||
, dgemm_blas=C_FUNLOC(dgemm_blas))
|
||||
nsgfa, ncob, ncoa, nsgfa, ncoa, nsgfa, 1.0D0, 0.0D0)
|
||||
rc2 = libxs_gemm_dispatch(cfg2, LIBXS_DATATYPE_F64, 'N', 'N', &
|
||||
nsgfa, nsgfb, ncob, nsgfa, ncob, nsgfa, 1.0D0, 0.0D0 &
|
||||
#if defined(__MKL)
|
||||
, jit_create_dgemm=C_FUNLOC(mkl_cblas_jit_create_dgemm) &
|
||||
, jit_get_dgemm=C_FUNLOC(mkl_jit_get_dgemm_ptr) &
|
||||
#endif
|
||||
#if defined(__LIBXSMM)
|
||||
, xgemm_dispatch=C_FUNLOC(libxsmm_dispatch_gemm) &
|
||||
#endif
|
||||
, dgemm_blas=C_FUNLOC(dgemm_blas))
|
||||
nsgfa, nsgfb, ncob, nsgfa, ncob, nsgfa, 1.0D0, 0.0D0)
|
||||
ELSE
|
||||
rc1 = libxs_gemm_dispatch(cfg1, LIBXS_DATATYPE_F64, 'N', 'N', &
|
||||
ncoa, nsgfb, ncob, ncoa, ncob, ncoa, 1.0D0, 0.0D0 &
|
||||
#if defined(__MKL)
|
||||
, jit_create_dgemm=C_FUNLOC(mkl_cblas_jit_create_dgemm) &
|
||||
, jit_get_dgemm=C_FUNLOC(mkl_jit_get_dgemm_ptr) &
|
||||
#endif
|
||||
#if defined(__LIBXSMM)
|
||||
, xgemm_dispatch=C_FUNLOC(libxsmm_dispatch_gemm) &
|
||||
#endif
|
||||
, dgemm_blas=C_FUNLOC(dgemm_blas))
|
||||
ncoa, nsgfb, ncob, ncoa, ncob, ncoa, 1.0D0, 0.0D0)
|
||||
rc2 = libxs_gemm_dispatch(cfg2, LIBXS_DATATYPE_F64, 'N', 'N', &
|
||||
nsgfa, nsgfb, ncoa, nsgfa, ncoa, nsgfa, 1.0D0, 0.0D0 &
|
||||
#if defined(__MKL)
|
||||
, jit_create_dgemm=C_FUNLOC(mkl_cblas_jit_create_dgemm) &
|
||||
, jit_get_dgemm=C_FUNLOC(mkl_jit_get_dgemm_ptr) &
|
||||
#endif
|
||||
#if defined(__LIBXSMM)
|
||||
, xgemm_dispatch=C_FUNLOC(libxsmm_dispatch_gemm) &
|
||||
#endif
|
||||
, dgemm_blas=C_FUNLOC(dgemm_blas))
|
||||
nsgfa, nsgfb, ncoa, nsgfa, ncoa, nsgfa, 1.0D0, 0.0D0)
|
||||
END IF
|
||||
IF (0 /= rc1 .AND. 0 /= rc2) THEN
|
||||
IF (ab_first) THEN
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ endif
|
|||
ifneq ($(LIBXS),0)
|
||||
LIBXSROOT ?= $(wildcard $(CP2KHOME)/../libxs)
|
||||
ifneq ($(LIBXSROOT),)
|
||||
CFLAGS += -D__LIBXS -D__BLAS -I$(LIBXSROOT)/include
|
||||
CFLAGS += -D__LIBXS -D__BLAS -I$(LIBXSROOT)
|
||||
LIBS += $(LIBXSROOT)/lib/libxs.a
|
||||
# LIBXSMM headers enable JIT kernel dispatch inside LIBXS.
|
||||
LIBXSMMROOT ?= $(wildcard $(LIBXSROOT)/../libxsmm)
|
||||
|
|
@ -88,7 +88,7 @@ ifneq ($(OPENCL),0)
|
|||
ifneq ($(LIBXS),0)
|
||||
LIBXSTREAMROOT ?= $(wildcard $(CP2KHOME)/../libxstream)
|
||||
ifneq ($(LIBXSTREAMROOT),)
|
||||
CFLAGS += -D__LIBXSTREAM -I$(LIBXSTREAMROOT)/include
|
||||
CFLAGS += -D__LIBXSTREAM -I$(LIBXSTREAMROOT)
|
||||
LIBS += $(LIBXSTREAMROOT)/lib/libxstream.a
|
||||
else
|
||||
OPENCL := 0
|
||||
|
|
@ -163,9 +163,9 @@ realclean: clean
|
|||
# Enable OpenCL offload backend.
|
||||
ifneq ($(OPENCL),0)
|
||||
OPENCL_SRC := $(PROJHOME)/dbm_multiply_opencl.cl
|
||||
OPENCL_CMN := $(wildcard $(LIBXSTREAMROOT)/include/opencl/*.h)
|
||||
OPENCL_CMN := $(wildcard $(LIBXSTREAMROOT)/libxstream/opencl/*.h)
|
||||
OPENCL_GEN := $(LIBXSTREAMROOT)/scripts/tool_opencl.sh
|
||||
OPENCL_ARG := -b 6 -p "" -I $(LIBXSTREAMROOT)/include
|
||||
OPENCL_ARG := -b 6 -p "" -I $(LIBXSTREAMROOT)/libxstream
|
||||
|
||||
ifneq (,$(filter-out 0,$(DBG)))
|
||||
OPENCL_ARG += -d
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <libxsmm.h>
|
||||
#endif
|
||||
#if defined(__LIBXS)
|
||||
#include <libxs_gemm.h>
|
||||
#include <libxs/libxs_gemm.h>
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "dbm_multiply_gpu_kernel.h"
|
||||
#include "dbm_multiply_opencl.cl.h"
|
||||
#include <libxs_reg.h>
|
||||
#include <libxs_timer.h>
|
||||
#include <libxstream_opencl.h>
|
||||
#include <libxs/libxs_reg.h>
|
||||
#include <libxs/libxs_timer.h>
|
||||
#include <libxstream/libxstream_opencl.h>
|
||||
|
||||
#if !defined(OPENCL_DBM_SOURCE_MULTIPLY)
|
||||
#error "OpenCL kernel source code not found!"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <libxsmm.h>
|
||||
#endif
|
||||
#if defined(__LIBXS)
|
||||
#include <libxs_gemm.h>
|
||||
#include <libxs/libxs_gemm.h>
|
||||
#endif
|
||||
|
||||
#include "../common/grid_common.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#elif defined(__OFFLOAD_HIP)
|
||||
#include <hip/hip_runtime_api.h>
|
||||
#elif defined(__OFFLOAD_OPENCL)
|
||||
#include <libxstream.h>
|
||||
#include <libxstream/libxstream.h>
|
||||
#endif
|
||||
|
||||
#if defined(__OFFLOAD_PROFILING)
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
#endif
|
||||
|
||||
#if defined(__LIBXSTREAM)
|
||||
#include <libxstream.h>
|
||||
#include <libxstream_opencl.h>
|
||||
#include <libxstream/libxstream.h>
|
||||
#include <libxstream/libxstream_opencl.h>
|
||||
#elif defined(__LIBXS)
|
||||
#include <libxs_malloc.h>
|
||||
#include <libxs/libxs_malloc.h>
|
||||
#endif
|
||||
|
||||
#define OFFLOAD_MEMPOOL_PRINT(FN, MSG, OUTPUT_UNIT) \
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include <hip/hip_version.h>
|
||||
#elif defined(__OFFLOAD_OPENCL)
|
||||
/* Types, macros, and functions provided by libxstream_cp2k.h. */
|
||||
#include <libxstream_cp2k.h>
|
||||
#include <libxstream/libxstream_cp2k.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -60,9 +60,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -60,9 +60,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -60,9 +60,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -60,9 +60,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -64,9 +64,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -64,9 +64,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -64,9 +64,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -60,9 +60,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ COPY ./tools/toolchain/scripts/VERSION \
|
|||
COPY ./tools/toolchain/install_cp2k_toolchain.sh .
|
||||
RUN ./install_cp2k_toolchain.sh \
|
||||
--mpi-mode=no \
|
||||
--with-dbcsr \
|
||||
--with-dbcsr=install \
|
||||
--with-gcc=system \
|
||||
--with-cmake=system \
|
||||
--with-ninja=system \
|
||||
|
|
@ -64,9 +64,11 @@ RUN ./install_cp2k_toolchain.sh \
|
|||
--with-libxc=no \
|
||||
--with-libint=no \
|
||||
--with-fftw=no \
|
||||
--with-libxsmm=no \
|
||||
--with-libxsmm=install \
|
||||
--with-libxs=install \
|
||||
--with-spglib=no \
|
||||
--with-libvori=no \
|
||||
--with-tblite=no \
|
||||
--dry-run
|
||||
|
||||
# Dry-run leaves behind config files for the followup install scripts.
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ COPY . cp2k/
|
|||
|
||||
# Build CP2K dependencies
|
||||
WORKDIR /opt/cp2k
|
||||
RUN ./make_cp2k.sh -bd_only -cv psmp -gpu none -gv 14 -mpi mpich -ue -df libxsmm -ef openpmd
|
||||
RUN ./make_cp2k.sh -bd_only -cv psmp -gpu none -gv 14 -mpi mpich -ue -ef openpmd
|
||||
|
||||
###### Stage 2: Build CP2K ######
|
||||
|
||||
FROM build_deps AS build_cp2k
|
||||
|
||||
RUN ./make_cp2k.sh -cv psmp -gv 14 -gpu none -mpi mpich -df libxsmm -ef openpmd
|
||||
RUN ./make_cp2k.sh -cv psmp -gv 14 -gpu none -mpi mpich -ef openpmd
|
||||
|
||||
###### Stage 3: Install CP2K ######
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ def main() -> None:
|
|||
mpi_mode="mpich",
|
||||
base_image="docker.io/rockylinux/rockylinux:10",
|
||||
gcc_version=14,
|
||||
feature_flags="-df libxsmm -ef openpmd",
|
||||
feature_flags="-ef openpmd",
|
||||
testopts=testopts,
|
||||
image_tag=f.image_tag,
|
||||
)
|
||||
|
|
@ -532,7 +532,7 @@ RUN ln -sf /usr/bin/gcc-{gcc_version} /usr/local/bin/gcc && \
|
|||
""" + install_toolchain(
|
||||
base_image=base_image,
|
||||
mpi_mode="no",
|
||||
with_dbcsr="",
|
||||
with_dbcsr="install",
|
||||
with_gcc="system",
|
||||
with_cmake="system",
|
||||
with_ninja="system",
|
||||
|
|
@ -540,9 +540,11 @@ RUN ln -sf /usr/bin/gcc-{gcc_version} /usr/local/bin/gcc && \
|
|||
with_libxc="no",
|
||||
with_libint="no",
|
||||
with_fftw="no",
|
||||
with_libxsmm="no",
|
||||
with_libxsmm="install",
|
||||
with_libxs="install",
|
||||
with_spglib="no",
|
||||
with_libvori="no",
|
||||
with_tblite="no",
|
||||
)
|
||||
|
||||
return output
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ spack:
|
|||
# CP2K
|
||||
- "adios2@2.12.0"
|
||||
- "cosma@2.8.4"
|
||||
- "dbcsr@2.9.1"
|
||||
- "dbcsr@2.9.2-preview"
|
||||
- "deepmdkit@3.1.3"
|
||||
# - "dftd4@4.0.2"
|
||||
- "dla-future@0.10.0"
|
||||
|
|
@ -213,8 +213,8 @@ spack:
|
|||
- "libvdwxc@0.5.0"
|
||||
- "libvori@220621"
|
||||
- "libxc@7.0.0"
|
||||
- "libxs@20260605"
|
||||
- "libxsmm@1.17-cp2k"
|
||||
- "libxs@20260611"
|
||||
- "libxsmm@20260610-cp2k"
|
||||
- "mimic-mcl@3.0.0"
|
||||
- "netlib-scalapack@2.2.3"
|
||||
- "openblas@0.3.33"
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ spack:
|
|||
- "ninja@1.13"
|
||||
- "python@3.11:"
|
||||
# CP2K
|
||||
- "dbcsr@2.9.1"
|
||||
- "dbcsr@2.9.2-preview"
|
||||
# - "dftd4@4.0.2"
|
||||
- "fftw@3.3.11"
|
||||
# - "hdf5@2.1.0"
|
||||
|
|
@ -110,8 +110,8 @@ spack:
|
|||
- "libint@2.13.1-cp2k-lmax-5"
|
||||
- "libvori@220621"
|
||||
- "libxc@7.0.0"
|
||||
- "libxs@20260605"
|
||||
- "libxsmm@1.17-cp2k"
|
||||
- "libxs@20260611"
|
||||
- "libxsmm@20260610-cp2k"
|
||||
- "openblas@0.3.33"
|
||||
- "pace@2025.12.4.1"
|
||||
- "spglib@2.7.0"
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ spack:
|
|||
- "ninja@1.13"
|
||||
- "python@3.11:"
|
||||
# CP2K
|
||||
- "dbcsr@2.9.1"
|
||||
- "dbcsr@2.9.2-preview"
|
||||
- "deepmdkit@3.1.3"
|
||||
# - "dftd4@4.0.2"
|
||||
- "fftw@3.3.11"
|
||||
|
|
@ -136,8 +136,8 @@ spack:
|
|||
- "libint@2.13.1-cp2k-lmax-5"
|
||||
- "libvori@220621"
|
||||
- "libxc@7.0.0"
|
||||
- "libxs@20260605"
|
||||
- "libxsmm@1.17-cp2k"
|
||||
- "libxs@20260611"
|
||||
- "libxsmm@20260610-cp2k"
|
||||
- "openblas@0.3.33"
|
||||
- "pace@2025.12.4.1"
|
||||
- "py-torch@2.12.0"
|
||||
|
|
|
|||
259
tools/spack/spack_repo/cp2k_dev/packages/dbcsr/package.py
Normal file
259
tools/spack/spack_repo/cp2k_dev/packages/dbcsr/package.py
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
# Copyright Spack Project Developers. See COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import os
|
||||
|
||||
from spack_repo.builtin.build_systems.cmake import CMakePackage, generator
|
||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class Dbcsr(CMakePackage, CudaPackage, ROCmPackage):
|
||||
"""Distributed Block Compressed Sparse Row matrix library."""
|
||||
|
||||
homepage = "https://github.com/cp2k/dbcsr"
|
||||
git = "https://github.com/cp2k/dbcsr.git"
|
||||
url = "https://github.com/cp2k/dbcsr/releases/download/v2.2.0/dbcsr-2.2.0.tar.gz"
|
||||
list_url = "https://github.com/cp2k/dbcsr/releases"
|
||||
|
||||
maintainers("dev-zero", "mtaillefumier", "RMeli", "hfp")
|
||||
|
||||
license("GPL-2.0-or-later")
|
||||
|
||||
version("develop", branch="develop")
|
||||
version("2.9.2-preview", commit="4d85b72e3427ec7f595ad0cf38a4d00f72f9ff60")
|
||||
version("2.9.1", sha256="fa5a4aeba0a07761511af2c26c779bd811b5ea0ef06a5d94535b6dd7b2e0ce59")
|
||||
version("2.9.0", sha256="a04cacd2203bd97a31ac993f9ab84237a48191140bba29efadbc27db544bbcd6")
|
||||
version("2.8.0", sha256="d55e4f052f28d1ed0faeaa07557241439243287a184d1fd27f875c8b9ca6bd96")
|
||||
|
||||
new_smm_versions = "@2.9.2-preview,2.9.2:,develop"
|
||||
|
||||
variant("tests", default=False, description="Build DBCSR unit tests")
|
||||
variant("tests", default=True, description="Build DBCSR unit tests", when="@2.1:2.2")
|
||||
variant("mpi", default=True, description="Compile with MPI")
|
||||
variant("openmp", default=True, description="Build with OpenMP support")
|
||||
variant("shared", default=True, description="Build shared library")
|
||||
variant(
|
||||
"smm",
|
||||
default="libxsmm",
|
||||
values=("libxsmm", "libxs", "blas"),
|
||||
description="Library for small matrix multiplications",
|
||||
)
|
||||
variant(
|
||||
"cuda_arch_35_k20x",
|
||||
default=False,
|
||||
description=(
|
||||
"CP2K (resp. DBCSR) has specific parameter sets for"
|
||||
" different GPU models. Enable this when building"
|
||||
" with cuda_arch=35 for a K20x instead of a K40"
|
||||
),
|
||||
)
|
||||
variant("examples", default=True, description="Build examples")
|
||||
|
||||
variant("opencl", default=False, description="Enable OpenCL backend")
|
||||
variant("mpi_f08", default=False, when="@2.6:", description="Use mpi F08 module")
|
||||
|
||||
depends_on("c", type="build") # generated
|
||||
depends_on("cxx", type="build") # generated
|
||||
depends_on("fortran", type="build") # generated
|
||||
|
||||
depends_on("blas")
|
||||
depends_on("lapack")
|
||||
depends_on("mpi", when="+mpi")
|
||||
|
||||
conflicts(
|
||||
"smm=libxs", when="@:2.9.1", msg="smm=libxs is only supported by DBCSR 2.9.2 or newer"
|
||||
)
|
||||
|
||||
depends_on("libxsmm@1.11:", when="@:2.9.1 smm=libxsmm")
|
||||
|
||||
with when(f"{new_smm_versions} smm=libxs"):
|
||||
depends_on("libxs")
|
||||
|
||||
with when(f"{new_smm_versions} smm=libxsmm"):
|
||||
depends_on("libxs")
|
||||
depends_on("libxsmm")
|
||||
|
||||
depends_on("cmake@3.10:", type="build")
|
||||
depends_on("cmake@3.12:", type="build", when="@2.1:")
|
||||
depends_on("cmake@3.17:", type="build", when="@2.2:")
|
||||
depends_on("cmake@3.22:", type="build", when="@2.3:")
|
||||
|
||||
depends_on("py-fypp", type="build")
|
||||
depends_on("py-fypp@3.1:", type="build", when="@2.6:")
|
||||
depends_on("pkgconfig", type="build")
|
||||
depends_on("python@3.6:", type="build", when="+cuda")
|
||||
|
||||
depends_on("hipblas", when="+rocm")
|
||||
|
||||
# Several packages provide "opencl" (incl. ICD/loader), e.g., "cuda"
|
||||
depends_on("opencl", when="+opencl")
|
||||
depends_on("libxstream", when="+opencl")
|
||||
opencl_loader_header_version = "2022.10.24"
|
||||
depends_on(f"opencl-c-headers@{opencl_loader_header_version}:", when="+opencl")
|
||||
requires(f"%opencl=opencl-icd-loader@{opencl_loader_header_version}:", when="+opencl")
|
||||
|
||||
# All examples require MPI
|
||||
conflicts("+examples", when="~mpi", msg="Examples require MPI")
|
||||
|
||||
# We only support specific gpu archs for which we have parameter files
|
||||
# for optimal kernels. Note that we don't override the parent class arch
|
||||
# properties, since the parent class defines constraints for different archs
|
||||
# Instead just mark all unsupported cuda archs as conflicting.
|
||||
dbcsr_cuda_archs = ("35", "37", "60", "70", "80", "90")
|
||||
cuda_msg = f"dbcsr only supports cuda_arch {dbcsr_cuda_archs}"
|
||||
|
||||
for arch in CudaPackage.cuda_arch_values:
|
||||
if arch not in dbcsr_cuda_archs:
|
||||
conflicts("+cuda", when=f"cuda_arch={arch}", msg=cuda_msg)
|
||||
|
||||
conflicts("+cuda", when="cuda_arch=none", msg=cuda_msg)
|
||||
|
||||
dbcsr_amdgpu_targets = (
|
||||
"gfx906",
|
||||
"gfx908",
|
||||
"gfx90a",
|
||||
"gfx90a:xnack-",
|
||||
"gfx90a:xnack+",
|
||||
"gfx942",
|
||||
"gfx950",
|
||||
)
|
||||
amd_msg = f"""DBCSR supports these AMD gpu targets: {", ".join(dbcsr_amdgpu_targets)}.
|
||||
Set amdgpu_target explicitly to one of the supported targets"""
|
||||
|
||||
for arch in ROCmPackage.amdgpu_targets:
|
||||
if arch not in dbcsr_amdgpu_targets:
|
||||
conflicts("+rocm", when=f"amdgpu_target={arch}", msg=amd_msg)
|
||||
|
||||
# GPU runtimes are usually mutually exclusive
|
||||
accel_msg = "CUDA and ROCm are mutually exlusive"
|
||||
conflicts("+cuda", when="+rocm", msg=accel_msg)
|
||||
conflicts("+cuda", when="+opencl", msg=accel_msg)
|
||||
conflicts("+rocm", when="+opencl", msg=accel_msg)
|
||||
|
||||
# Require OpenMP threading by making other options conflict
|
||||
conflicts("^intel-oneapi-mkl threads=none", when="+openmp")
|
||||
conflicts("^intel-oneapi-mkl threads=tbb", when="+openmp")
|
||||
conflicts("^openblas threads=pthreads", when="+openmp")
|
||||
conflicts("^openblas threads=none", when="+openmp")
|
||||
|
||||
# OpenCL follows the legacy LIBXSMM SMM path up to DBCSR 2.9.1.
|
||||
requires("smm=libxsmm", when="+opencl @:2.9.1")
|
||||
|
||||
# Starting with the 2.9.2 interface, LIBXS is an explicit SMM backend.
|
||||
requires("smm=libxs", when=f"+opencl {new_smm_versions}")
|
||||
|
||||
with when("+mpi"):
|
||||
# When using mpich 4.1 or higher, mpi_f08 has to be used, otherwise:
|
||||
# Error: Type mismatch in argument 'baseptr' at (1); passed TYPE(c_ptr)
|
||||
# to INTEGER(8)
|
||||
conflicts("^mpich@4.1:", when="@:2.5")
|
||||
conflicts("~mpi_f08", when="^mpich@4.1:")
|
||||
depends_on("mpich+fortran", when="^[virtuals=mpi] mpich")
|
||||
|
||||
generator("ninja")
|
||||
depends_on("ninja@1.10:", type="build")
|
||||
|
||||
@when("+rocm")
|
||||
def patch(self):
|
||||
for directory, subdirectory, files in os.walk(os.getcwd()):
|
||||
for i in files:
|
||||
file_path = os.path.join(directory, i)
|
||||
filter_file("USE ISO_C_BINDING", "USE,INTRINSIC :: ISO_C_BINDING", file_path)
|
||||
filter_file("USE ISO_FORTRAN_ENV", "USE,INTRINSIC :: ISO_FORTRAN_ENV", file_path)
|
||||
filter_file("USE omp_lib", "USE,INTRINSIC :: omp_lib", file_path)
|
||||
filter_file("USE OMP_LIB", "USE,INTRINSIC :: OMP_LIB", file_path)
|
||||
filter_file("USE iso_c_binding", "USE,INTRINSIC :: iso_c_binding", file_path)
|
||||
filter_file("USE iso_fortran_env", "USE,INTRINSIC :: iso_fortran_env", file_path)
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
|
||||
if "+cuda" in spec and len(spec.variants["cuda_arch"].value) > 1:
|
||||
raise InstallError("dbcsr supports only one cuda_arch at a time")
|
||||
|
||||
if "+rocm" in spec and len(spec.variants["amdgpu_target"].value) > 1:
|
||||
raise InstallError("DBCSR supports only one amdgpu_arch at a time")
|
||||
|
||||
smm = spec.variants["smm"].value
|
||||
has_libxs_smm = (
|
||||
spec.satisfies("@2.9.2-preview")
|
||||
or spec.satisfies("@2.9.2:")
|
||||
or spec.satisfies("@develop")
|
||||
)
|
||||
|
||||
args = [
|
||||
self.define_from_variant("USE_MPI", "mpi"),
|
||||
self.define_from_variant("USE_OPENMP", "openmp"),
|
||||
# C API needs MPI
|
||||
self.define_from_variant("WITH_C_API", "mpi"),
|
||||
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
|
||||
self.define_from_variant("WITH_EXAMPLES", "examples"),
|
||||
self.define_from_variant("BUILD_TESTING", "tests"),
|
||||
]
|
||||
|
||||
if has_libxs_smm:
|
||||
args += [
|
||||
self.define("USE_LIBXS", smm in ("libxs", "libxsmm")),
|
||||
self.define("USE_LIBXSMM", smm == "libxsmm"),
|
||||
]
|
||||
else:
|
||||
args.append("-DUSE_SMM=%s" % ("libxsmm" if smm == "libxsmm" else "blas"))
|
||||
|
||||
lapack, blas = spec["lapack"], spec["blas"]
|
||||
if blas.name != "intel-oneapi-mkl":
|
||||
args += [
|
||||
"-DBLAS_FOUND=true",
|
||||
"-DBLAS_LIBRARIES=%s" % (blas.libs.joined(";")),
|
||||
"-DLAPACK_FOUND=true",
|
||||
"-DLAPACK_LIBRARIES=%s" % (lapack.libs.joined(";")),
|
||||
]
|
||||
|
||||
if self.spec.satisfies("+cuda"):
|
||||
cuda_arch = self.spec.variants["cuda_arch"].value[0]
|
||||
|
||||
gpu_map = {
|
||||
"35": "K40",
|
||||
"37": "K80",
|
||||
"60": "P100",
|
||||
"70": "V100",
|
||||
"80": "A100",
|
||||
"90": "H100",
|
||||
}
|
||||
|
||||
gpuver = gpu_map[cuda_arch]
|
||||
if cuda_arch == "35" and self.spec.satisfies("+cuda_arch_35_k20x"):
|
||||
gpuver = "K20X"
|
||||
|
||||
args += ["-DWITH_GPU=%s" % gpuver, "-DUSE_ACCEL=cuda"]
|
||||
|
||||
if self.spec.satisfies("+rocm"):
|
||||
amd_arch = self.spec.variants["amdgpu_target"].value[0]
|
||||
gpuver = {
|
||||
"gfx906": "Mi50",
|
||||
"gfx908": "Mi100",
|
||||
"gfx90a": "Mi250",
|
||||
"gfx90a:xnack-": "Mi250",
|
||||
"gfx90a:xnack+": "Mi250",
|
||||
"gfx942": "Mi300",
|
||||
"gfx950": "Mi350",
|
||||
}[amd_arch]
|
||||
|
||||
args += [f"-DWITH_GPU={gpuver}", "-DUSE_ACCEL=hip"]
|
||||
|
||||
if self.spec.satisfies("+opencl"):
|
||||
args += ["-DUSE_ACCEL=opencl"]
|
||||
|
||||
if self.spec.satisfies("+mpi_f08"):
|
||||
args += ["-DUSE_MPI_F08=ON"]
|
||||
|
||||
return args
|
||||
|
||||
def check(self):
|
||||
"""Override CMakePackage's check() to enforce seralized test runs
|
||||
since they are already parallelized"""
|
||||
with working_dir(self.build_directory):
|
||||
self._if_ninja_target_execute("test", parallel=False)
|
||||
|
|
@ -25,6 +25,7 @@ class Libxs(CMakePackage):
|
|||
license("BSD-3-Clause", checked_by="mkrack")
|
||||
|
||||
version("main", branch="main")
|
||||
version("20260611", commit="81914e78a9dc440a7bf4514a6312240b68d114e9")
|
||||
version("20260605", commit="ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0")
|
||||
|
||||
variant("fortran", default=False, description="Build Fortran module interface")
|
||||
|
|
@ -43,6 +44,6 @@ class Libxs(CMakePackage):
|
|||
args = [
|
||||
self.define_from_variant("LIBXS_FORTRAN", "fortran"),
|
||||
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
|
||||
self.define_from_variant("LIBXS_SHARED", "shared"),
|
||||
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
|
||||
]
|
||||
return args
|
||||
|
|
|
|||
|
|
@ -2,15 +2,12 @@
|
|||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
from spack_repo.builtin.build_systems.makefile import MakefilePackage
|
||||
from spack_repo.builtin.build_systems.cmake import CMakePackage
|
||||
|
||||
from spack.package import *
|
||||
|
||||
|
||||
class Libxsmm(MakefilePackage):
|
||||
class Libxsmm(CMakePackage):
|
||||
"""Library for specialized dense
|
||||
and sparse matrix operations,
|
||||
and deep learning primitives."""
|
||||
|
|
@ -23,58 +20,12 @@ class Libxsmm(MakefilePackage):
|
|||
|
||||
license("BSD-3-Clause")
|
||||
|
||||
# 2.0 release is planned for Jan / Feb 2024. This commit from main is added
|
||||
# as a stable version that supports other targets than x86. Remove this
|
||||
# after 2.0 release.
|
||||
version("main-2023-11", commit="0d9be905527ba575c14ca5d3b4c9673916c868b2")
|
||||
version("main", branch="main")
|
||||
version("20260610-cp2k", commit="79033a7a1da039681cfa3b5ed2fe662a401fa4f3")
|
||||
version("20260526-cp2k", commit="0cea22fdc34ec54bc59ffb47a43cb3e28b26d3e0")
|
||||
version("1.17-cp2k", commit="e0c4a2389afba36c453233ad7de07bd92c715bec")
|
||||
version(
|
||||
"1.17",
|
||||
sha256="8b642127880e92e8a75400125307724635ecdf4020ca4481e5efe7640451bb92",
|
||||
preferred=True,
|
||||
)
|
||||
version("1.16.3", sha256="e491ccadebc5cdcd1fc08b5b4509a0aba4e2c096f53d7880062a66b82a0baf84")
|
||||
version("1.16.2", sha256="bdc7554b56b9e0a380fc9c7b4f4394b41be863344858bc633bc9c25835c4c64e")
|
||||
version("1.16.1", sha256="93dc7a3ec40401988729ddb2c6ea2294911261f7e6cd979cf061b5c3691d729d")
|
||||
version("1.16", sha256="4f4f2ad97815413af80821d2e306eb6f00541941ad412662da05c02361a20e07")
|
||||
version("1.15", sha256="499e5adfbf90cd3673309243c2b56b237d54f86db2437e1ac06c8746b55ab91c")
|
||||
version("1.14", sha256="9c0af4509ea341d1ee2c6c19fc6f19289318c3bd4b17844efeb9e7f9691abf76")
|
||||
version("1.13", sha256="47c034e169820a9633770eece0e0fdd8d4a744e09b81da2af8c2608a4625811e")
|
||||
version("1.12.1", sha256="3687fb98da00ba92cd50b5f0d18b39912c7886dad3856843573aee0cb34e9791")
|
||||
version("1.12", sha256="37432fae4404ca12d8c5a205bfec7f9326c2d607d9ec37680f42dae60b52382a")
|
||||
version("1.11", sha256="5fc1972471cd8e2b8b64ea017590193739fc88d9818e3d086621e5c08e86ea35")
|
||||
version("1.10", sha256="2904f7983719fd5c5af081121c1d028d45b10b854aec9a9e67996a0602631abc")
|
||||
version("1.9", sha256="cd8532021352b4a0290d209f7f9bfd7c2411e08286a893af3577a43457287bfa")
|
||||
version("1.8.3", sha256="08ed4a67731d07c739fa83c426a06a5a8fe576bc273da4bab84eb0d1f4405011")
|
||||
version("1.8.2", sha256="252ab73e437f5fcc87268df1ac130ffe6eb41e4281d9d3a3eaa7d591a85a612f")
|
||||
version("1.8.1", sha256="2ade869c3f42f23b5263c7d594aa3c7e5e61ac6a3afcaf5d6e42899d2a7986ce")
|
||||
version("1.8", sha256="0330201afb5525d0950ec861fec9dd75eb40a03845ebe03d2c635cf8bfc14fea")
|
||||
version("1.7.1", sha256="9d3f63ce3eed62f04e4036de6f2be2ce0ff07781ca571af6e0bf85b077edf17a")
|
||||
version("1.7", sha256="2eea65624a697e74b939511cd2a686b4c957e90c99be168fe134d96771e811ad")
|
||||
version("1.6.6", sha256="7c048a48e17f7f14a475be7b83e6e941289e03debb42ce9e02a06353412f9f2a")
|
||||
version("1.6.5", sha256="5231419a8e13e7a6d286cf25d32a3aa75c443a625e5ea57024d36468bc3d5936")
|
||||
version("1.6.4", sha256="3788bf1cdb60f119f8a04ed7ed96861322e539ce2d2ea977f00431d6b2b80beb")
|
||||
version("1.6.3", sha256="afad4f75ec5959bc3b18b741f3f16864f699c8b763598d01faf6af029dded48c")
|
||||
version("1.6.2", sha256="c1ad21dee1239c9c2422b2dd2dc83e7a364909fc82ff9bd6ce7d9c73ee4569de")
|
||||
version("1.6.1", sha256="1dd81077b186300122dc8a8f1872c21fd2bd9b88286ab9f068cc7b62fa7593a7")
|
||||
version("1.6", sha256="c2a56f8cdc2ab03a6477ef98dbaa00917674fda59caa2824a1a29f78d2255ba5")
|
||||
version("1.5.2", sha256="a037b7335932921960d687ef3d49b50ee38a83e0c8ad237bc20d3f4a0523f7d3")
|
||||
version("1.5.1", sha256="9e2a400e63b6fb2d4954e53536090eb8eb6f0ca25d0f34dd3a4f166802aa3d54")
|
||||
version("1.5", sha256="c52568c5e0e8dc9d8fcf869a716d73598e52f71c3d83af5a4c0b3be81403b423")
|
||||
version("1.4.4", sha256="bf4a0fff05cf721e11cb6cdb74f3d27dd0fa67ccc024055f2d9dd5dbd928c7c0")
|
||||
version("1.4.3", sha256="5033c33038ba4a75c675387aeb7c86b629e43ffc0a40df0b78e4ed52e4b5bd90")
|
||||
version("1.4.2", sha256="9c89391635be96759486a245365793bc4593859e6d7957b37c39a29f9b4f95eb")
|
||||
version("1.4.1", sha256="c19be118694c9b4e9a61ef4205b1e1a7e0c400c07f9bce65ae430d2dc2be5fe1")
|
||||
version("1.4", sha256="cf483a370d802bd8800c06a12d14d2b4406a745c8a0b2c8722ccc992d0cd72dd")
|
||||
|
||||
variant("shared", default=False, description="With shared libraries (and static libraries).")
|
||||
variant("debug", default=False, description="With call-trace (LIBXSMM_TRACE); unoptimized.")
|
||||
variant(
|
||||
"header-only", default=False, when="@1.6.2:", description="With header-only installation"
|
||||
)
|
||||
variant("generator", default=False, description="With generator executable(s)")
|
||||
variant(
|
||||
"blas",
|
||||
default="default",
|
||||
|
|
@ -82,23 +33,15 @@ class Libxsmm(MakefilePackage):
|
|||
description="Control behavior of BLAS calls",
|
||||
values=("default", "0", "1", "2"),
|
||||
)
|
||||
variant(
|
||||
"large_jit_buffer",
|
||||
default=False,
|
||||
when="@1.17:",
|
||||
description="Max. JIT buffer size increased to 256 KiB",
|
||||
)
|
||||
variant(
|
||||
"wrap",
|
||||
default="0",
|
||||
description="Set WRAP to determines the kind of routine called for intercepted GEMMs",
|
||||
)
|
||||
|
||||
depends_on("c", type="build") # generated
|
||||
depends_on("cxx", type="build") # generated
|
||||
depends_on("fortran", type="build") # generated
|
||||
|
||||
depends_on("python", type="build")
|
||||
depends_on("cmake@3.13:", type="build")
|
||||
depends_on("blas", when="blas=1")
|
||||
depends_on("blas", when="blas=2")
|
||||
|
||||
# A recent `as` is needed to compile libxmss until version 1.17
|
||||
# (<https://github.com/spack/spack/issues/28404>), but not afterwards
|
||||
|
|
@ -118,66 +61,11 @@ class Libxsmm(MakefilePackage):
|
|||
)
|
||||
return result
|
||||
|
||||
def build(self, spec, prefix):
|
||||
# include symbols by default
|
||||
make_args = [
|
||||
"CC={0}".format(spack_cc),
|
||||
"CXX={0}".format(spack_cxx),
|
||||
"FC={0}".format(spack_fc),
|
||||
"PREFIX=%s" % prefix,
|
||||
]
|
||||
# if spec.target.family == "aarch64":
|
||||
# make_args += ["PLATFORM=1"]
|
||||
# else:
|
||||
# make_args += ["SYM=1"]
|
||||
|
||||
# JIT (AVX and later) makes MNK, M, N, or K spec. superfluous
|
||||
# make_args += ['MNK=1 4 5 6 8 9 13 16 17 22 23 24 26 32']
|
||||
|
||||
# include call trace as the build is already de-optimized
|
||||
if spec.satisfies("+debug"):
|
||||
make_args += ["DBG=1"]
|
||||
make_args += ["TRACE=1"]
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
blas_val = spec.variants["blas"].value
|
||||
if blas_val != "default":
|
||||
make_args += ["BLAS={0}".format(blas_val)]
|
||||
|
||||
if spec.satisfies("+large_jit_buffer"):
|
||||
make_args += ["CODE_BUF_MAXSIZE=262144"]
|
||||
|
||||
if spec.satisfies("+shared"):
|
||||
make(*(make_args + ["STATIC=0"]))
|
||||
|
||||
wrap_val = spec.variants["wrap"].value
|
||||
make_args += ["WRAP={0}".format(wrap_val)]
|
||||
|
||||
# builds static libraries by default
|
||||
make(*make_args)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
install_tree("include", prefix.include)
|
||||
|
||||
# move pkg-config files to their right place
|
||||
mkdirp("lib/pkgconfig")
|
||||
for pcfile in glob("lib/*.pc"):
|
||||
os.rename(pcfile, os.path.join("lib/pkgconfig", os.path.basename(pcfile)))
|
||||
|
||||
# always install libraries
|
||||
install_tree("lib", prefix.lib)
|
||||
|
||||
if spec.satisfies("+header-only"):
|
||||
install_tree("src", prefix.src)
|
||||
|
||||
if spec.satisfies("+generator"):
|
||||
install_tree("bin", prefix.bin)
|
||||
|
||||
mkdirp(prefix.doc)
|
||||
install(join_path("documentation", "*.md"), prefix.doc)
|
||||
install(join_path("documentation", "*.pdf"), prefix.doc)
|
||||
if spec.satisfies("@1.8.2:"):
|
||||
install("LICENSE.md", prefix.doc)
|
||||
else:
|
||||
install("README.md", prefix.doc)
|
||||
install("LICENSE", prefix.doc)
|
||||
install("version.txt", prefix.doc)
|
||||
return [
|
||||
self.define("XSMM_STATIC", not spec.satisfies("+shared")),
|
||||
self.define("XSMM_BLAS", blas_val in ("1", "2")),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1137,6 +1137,7 @@ if [ "${ENABLE_OPENCL}" = "__TRUE__" ]; then
|
|||
fi
|
||||
else
|
||||
if [ "${with_libxstream}" != "__DONTUSE__" ]; then
|
||||
report_warning ${LINENO} "LIBXSTREAM is only used by the OpenCL backend; disabling it because OpenCL is not enabled."
|
||||
with_libxstream="__DONTUSE__"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
|
||||
|
||||
libxs_ver="ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0"
|
||||
libxs_sha256="e264e2cb1cc4fdf2d426ebb95b98e745022b8193bc8e4abfa761c4af9d6f1c54"
|
||||
libxs_ver="81914e7"
|
||||
libxs_sha256="afa98ef4f3fab9c5500fb3a5a3179aabf1ff29013da8b201f164afd2215ff996"
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
source "${SCRIPT_DIR}"/signal_trap.sh
|
||||
|
|
@ -31,8 +31,8 @@ case "$with_libxs" in
|
|||
echo "libxs-${libxs_ver}.tar.gz is found"
|
||||
else
|
||||
if ! download_pkg_from_cp2k_org "${libxs_sha256}" "libxs-${libxs_ver}.tar.gz" 2> /dev/null; then
|
||||
download_pkg_from_urlpath "${libxs_sha256}" "${libxs_ver}.tar.gz" \
|
||||
https://github.com/hfp/libxs/archive \
|
||||
download_pkg_from_urlpath "${libxs_sha256}" "${libxs_ver}" \
|
||||
https://codeload.github.com/hfp/libxs/tar.gz \
|
||||
"libxs-${libxs_ver}.tar.gz"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -41,20 +41,13 @@ case "$with_libxs" in
|
|||
|
||||
echo "Installing from scratch into ${pkg_install_dir}"
|
||||
cd libxs-${libxs_ver}
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
FC=$FC \
|
||||
FORTRAN=1 \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
> make.log 2>&1 || tail_excerpt make.log
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
FC=$FC \
|
||||
FORTRAN=1 \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
install > install.log 2>&1 || tail_excerpt install.log
|
||||
mkdir build && cd build
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
-DLIBXS_FORTRAN=ON \
|
||||
.. > configure.log 2>&1 || tail_excerpt configure.log
|
||||
make install -j $(get_nprocs) > make.log 2>&1 || tail_excerpt make.log
|
||||
cd ..
|
||||
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
|
||||
|
||||
|
|
@ -89,24 +82,17 @@ if [ "$with_libxs" != "__DONTUSE__" ]; then
|
|||
LIBXS_LIBS="-lxs -ldl -lpthread"
|
||||
cat << EOF > "${BUILDDIR}/setup_libxs"
|
||||
export LIBXS_VER="${libxs_ver}"
|
||||
export LIBXS_ROOT="${pkg_install_dir}"
|
||||
EOF
|
||||
if [ "$with_libxs" != "__SYSTEM__" ]; then
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxs"
|
||||
prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LD_RUN_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig"
|
||||
prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig"
|
||||
prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}"
|
||||
EOF
|
||||
fi
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxs"
|
||||
export LIBXS_CFLAGS="${LIBXS_CFLAGS}"
|
||||
export LIBXS_LDFLAGS="${LIBXS_LDFLAGS}"
|
||||
export LIBXS_LIBS="${LIBXS_LIBS}"
|
||||
export CP_DFLAGS="-D__LIBXS \${CP_DFLAGS}"
|
||||
export CP_CFLAGS="\${CP_CFLAGS} ${LIBXS_CFLAGS}"
|
||||
export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXS_LDFLAGS}"
|
||||
export CP_LIBS="\${LIBXS_LIBS} \${CP_LIBS}"
|
||||
EOF
|
||||
filter_setup "${BUILDDIR}/setup_libxs" "${SETUPFILE}"
|
||||
fi
|
||||
cd "${ROOTDIR}"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
|
||||
|
||||
libxsmm_ver="0cea22fdc34ec54bc59ffb47a43cb3e28b26d3e0"
|
||||
libxsmm_sha256="9404da8173009677d7814b51442250eee95d41773cae55b802f75fb40aece73d"
|
||||
libxsmm_ver="79033a7"
|
||||
libxsmm_sha256="b268dafa1c27ee9a3b194ebc0726a9488d13a59f0d789df348b902bfb073c519"
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
source "${SCRIPT_DIR}"/signal_trap.sh
|
||||
|
|
@ -38,41 +38,23 @@ EOF
|
|||
echo "libxsmm-${libxsmm_ver}.tar.gz is found"
|
||||
else
|
||||
if ! download_pkg_from_cp2k_org "${libxsmm_sha256}" "libxsmm-${libxsmm_ver}.tar.gz" 2> /dev/null; then
|
||||
download_pkg_from_urlpath "${libxsmm_sha256}" "${libxsmm_ver}.tar.gz" \
|
||||
https://github.com/libxsmm/libxsmm/archive \
|
||||
download_pkg_from_urlpath "${libxsmm_sha256}" "${libxsmm_ver}" \
|
||||
https://codeload.github.com/libxsmm/libxsmm/tar.gz \
|
||||
"libxsmm-${libxsmm_ver}.tar.gz"
|
||||
fi
|
||||
fi
|
||||
echo "Installing from scratch into ${pkg_install_dir}"
|
||||
[ -d libxsmm-${libxsmm_ver} ] && rm -rf libxsmm-${libxsmm_ver}
|
||||
tar -xzf libxsmm-${libxsmm_ver}.tar.gz
|
||||
# note that we do not have to set -L flags to ld for the
|
||||
# linked math libraries for the libxsmm build, as for a
|
||||
# library this is not required, you just have to provide
|
||||
# the appropriate -L flags (LDFLAGS) during the linking
|
||||
# stage of building an executable that uses the libxsmm
|
||||
# library
|
||||
cd libxsmm-${libxsmm_ver}
|
||||
# Avoid an unintended (incompatible) setting of FORTRAN
|
||||
unset FORTRAN
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
FC=$FC \
|
||||
WRAP=0 \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
> make.log 2>&1 || tail_excerpt make.log
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
FC=$FC \
|
||||
WRAP=0 \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
install > install.log 2>&1 || tail_excerpt install.log
|
||||
mkdir build && cd build
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
.. > configure.log 2>&1 || tail_excerpt configure.log
|
||||
make install -j $(get_nprocs) > make.log 2>&1 || tail_excerpt make.log
|
||||
cd ..
|
||||
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
|
||||
mkdir ${pkg_install_dir}/lib/pkgconfig
|
||||
cp ${pkg_install_dir}/lib/*.pc ${pkg_install_dir}/lib/pkgconfig
|
||||
|
||||
# ---- macOS: pkg-config files must not use GNU ld's "-l:libfoo.a" syntax ----
|
||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
||||
|
|
@ -87,8 +69,6 @@ EOF
|
|||
__SYSTEM__)
|
||||
echo "==================== Finding Libxsmm from system paths ===================="
|
||||
check_lib -lxsmm "libxsmm"
|
||||
check_lib -lxsmmf "libxsmm"
|
||||
check_lib -lxsmmext "libxsmm"
|
||||
add_include_from_paths LIBXSMM_CFLAGS "libxsmm.h" $INCLUDE_PATHS
|
||||
add_lib_from_paths LIBXSMM_LDFLAGS "libxsmm.*" $LIB_PATHS
|
||||
;;
|
||||
|
|
@ -97,7 +77,6 @@ EOF
|
|||
*)
|
||||
echo "==================== Linking Libxsmm to user paths ===================="
|
||||
pkg_install_dir="$with_libxsmm"
|
||||
check_dir "${pkg_install_dir}/bin"
|
||||
check_dir "${pkg_install_dir}/include"
|
||||
check_dir "${pkg_install_dir}/lib"
|
||||
LIBXSMM_CFLAGS="-I'${pkg_install_dir}/include'"
|
||||
|
|
@ -105,29 +84,20 @@ EOF
|
|||
;;
|
||||
esac
|
||||
if [ "$with_libxsmm" != "__DONTUSE__" ]; then
|
||||
LIBXSMM_LIBS="-lxsmmf -lxsmmext -lxsmm -ldl -lpthread"
|
||||
LIBXSMM_LIBS="-lxsmm -ldl -lpthread"
|
||||
cat << EOF > "${BUILDDIR}/setup_libxsmm"
|
||||
export LIBXSMM_VER="${libxsmm_ver}"
|
||||
export LIBXSMMROOT="${pkg_install_dir:-}"
|
||||
export LIBXSMM_ROOT="${pkg_install_dir:-}"
|
||||
EOF
|
||||
if [ "$with_libxsmm" != "__SYSTEM__" ]; then
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxsmm"
|
||||
prepend_path PATH "${pkg_install_dir}/bin"
|
||||
prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LD_RUN_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig"
|
||||
prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig"
|
||||
prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}"
|
||||
EOF
|
||||
fi
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxsmm"
|
||||
export LIBXSMM_CFLAGS="${LIBXSMM_CFLAGS}"
|
||||
export LIBXSMM_LDFLAGS="${LIBXSMM_LDFLAGS}"
|
||||
export LIBXSMM_LIBS="${LIBXSMM_LIBS}"
|
||||
export CP_DFLAGS="-D__LIBXSMM \${CP_DFLAGS}"
|
||||
export CP_CFLAGS="\${CP_CFLAGS} ${LIBXSMM_CFLAGS}"
|
||||
export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXSMM_LDFLAGS}"
|
||||
export CP_LIBS="\${LIBXSMM_LIBS} \${CP_LIBS}"
|
||||
EOF
|
||||
filter_setup "${BUILDDIR}/setup_libxsmm" "${SETUPFILE}"
|
||||
fi
|
||||
cd "${ROOTDIR}"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
|
||||
|
||||
libxstream_ver="8015f5461e5d1fee08024ddf20b38ea4400fbc24"
|
||||
libxstream_sha256="f2c41d2c0cbe1fd6d8001d78834caf1e978acdec61e4d873373684be6e98d981"
|
||||
libxstream_ver="a1e21a1"
|
||||
libxstream_sha256="22ee6e00533957ebd8ecdac9e89e0585afe1bb097567b379080bffff64faad54"
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
source "${SCRIPT_DIR}"/signal_trap.sh
|
||||
|
|
@ -38,8 +38,8 @@ case "$with_libxstream" in
|
|||
echo "libxstream-${libxstream_ver}.tar.gz is found"
|
||||
else
|
||||
if ! download_pkg_from_cp2k_org "${libxstream_sha256}" "libxstream-${libxstream_ver}.tar.gz" 2> /dev/null; then
|
||||
download_pkg_from_urlpath "${libxstream_sha256}" "${libxstream_ver}.tar.gz" \
|
||||
https://github.com/hfp/libxstream/archive \
|
||||
download_pkg_from_urlpath "${libxstream_sha256}" "${libxstream_ver}" \
|
||||
https://codeload.github.com/hfp/libxstream/tar.gz \
|
||||
"libxstream-${libxstream_ver}.tar.gz"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -48,23 +48,27 @@ case "$with_libxstream" in
|
|||
|
||||
echo "Installing from scratch into ${pkg_install_dir}"
|
||||
cd libxstream-${libxstream_ver}
|
||||
# Determine LIBXS install location
|
||||
local libxs_prefix="${INSTALLDIR}/libxs-${LIBXS_VER:-${libxs_ver:-unknown}}"
|
||||
if [ -z "${LIBXSROOT}" ] && [ -d "${libxs_prefix}" ]; then
|
||||
# Determine LIBXS install location.
|
||||
libxs_prefix="${LIBXSROOT:-}"
|
||||
if [ -z "${libxs_prefix}" ] && command -v pkg-config > /dev/null 2>&1 && pkg-config --exists libxs; then
|
||||
libxs_prefix="$(pkg-config --variable=prefix libxs)"
|
||||
fi
|
||||
if [ -z "${libxs_prefix}" ] && [ -d "${INSTALLDIR}/libxs-${LIBXS_VER:-${libxs_ver:-unknown}}" ]; then
|
||||
libxs_prefix="${INSTALLDIR}/libxs-${LIBXS_VER:-${libxs_ver:-unknown}}"
|
||||
fi
|
||||
if [ -z "${LIBXSROOT}" ] && [ -n "${libxs_prefix}" ]; then
|
||||
LIBXSROOT="${libxs_prefix}"
|
||||
fi
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
LIBXSROOT="${LIBXSROOT}" \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
> make.log 2>&1 || tail_excerpt make.log
|
||||
make -j $(get_nprocs) \
|
||||
CXX=$CXX \
|
||||
CC=$CC \
|
||||
LIBXSROOT="${LIBXSROOT}" \
|
||||
PREFIX=${pkg_install_dir} \
|
||||
install > install.log 2>&1 || tail_excerpt install.log
|
||||
if [ -z "${LIBXSROOT}" ]; then
|
||||
report_error $LINENO "LIBXSTREAM requires LIBXSROOT. Install LIBXS first or set LIBXSROOT."
|
||||
exit 1
|
||||
fi
|
||||
mkdir build && cd build
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
.. > configure.log 2>&1 || tail_excerpt configure.log
|
||||
make install -j $(get_nprocs) > make.log 2>&1 || tail_excerpt make.log
|
||||
cd ..
|
||||
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
|
||||
|
||||
|
|
@ -99,23 +103,17 @@ if [ "$with_libxstream" != "__DONTUSE__" ]; then
|
|||
LIBXSTREAM_LIBS="-lxstream"
|
||||
cat << EOF > "${BUILDDIR}/setup_libxstream"
|
||||
export LIBXSTREAM_VER="${libxstream_ver}"
|
||||
export LIBXSTREAM_ROOT="${pkg_install_dir}"
|
||||
EOF
|
||||
if [ "$with_libxstream" != "__SYSTEM__" ]; then
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxstream"
|
||||
prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LD_RUN_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path LIBRARY_PATH "${pkg_install_dir}/lib"
|
||||
prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig"
|
||||
prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig"
|
||||
prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}"
|
||||
EOF
|
||||
fi
|
||||
cat << EOF >> "${BUILDDIR}/setup_libxstream"
|
||||
export LIBXSTREAM_CFLAGS="${LIBXSTREAM_CFLAGS}"
|
||||
export LIBXSTREAM_LDFLAGS="${LIBXSTREAM_LDFLAGS}"
|
||||
export LIBXSTREAM_LIBS="${LIBXSTREAM_LIBS}"
|
||||
export CP_CFLAGS="\${CP_CFLAGS} ${LIBXSTREAM_CFLAGS}"
|
||||
export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBXSTREAM_LDFLAGS}"
|
||||
export CP_LIBS="\${LIBXSTREAM_LIBS} \${CP_LIBS}"
|
||||
EOF
|
||||
filter_setup "${BUILDDIR}/setup_libxstream" "${SETUPFILE}"
|
||||
fi
|
||||
cd "${ROOTDIR}"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
|
||||
SCRIPT_DIR="$(cd "$(dirname "${SCRIPT_NAME}")/.." && pwd -P)"
|
||||
|
||||
dbcsr_ver="0df59460c6cb1e8069080f1ce9caf0d382b8d0ef"
|
||||
dbcsr_sha256="e87fc029197f7d139429e4961f79cba52797dbd8b35fee6c1f1ed9bc81484a9e"
|
||||
dbcsr_ver="4d85b72"
|
||||
dbcsr_sha256="33461c7313e432b8902c9484ec327550d01b32b1b487020d3372d0ddd19265dc"
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
source "${SCRIPT_DIR}"/signal_trap.sh
|
||||
|
|
@ -31,8 +31,8 @@ case "${with_dbcsr}" in
|
|||
echo "dbcsr-${dbcsr_ver}.tar.gz is found"
|
||||
else
|
||||
if ! download_pkg_from_cp2k_org "${dbcsr_sha256}" "dbcsr-${dbcsr_ver}.tar.gz" 2> /dev/null; then
|
||||
download_pkg_from_urlpath "${dbcsr_sha256}" "${dbcsr_ver}.tar.gz" \
|
||||
https://github.com/cp2k/dbcsr/archive \
|
||||
download_pkg_from_urlpath "${dbcsr_sha256}" "${dbcsr_ver}" \
|
||||
https://codeload.github.com/cp2k/dbcsr/tar.gz \
|
||||
"dbcsr-${dbcsr_ver}.tar.gz"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -64,11 +64,14 @@ case "${with_dbcsr}" in
|
|||
fi
|
||||
mkdir build-cpu
|
||||
cd build-cpu
|
||||
CMAKE_OPTIONS="-DBUILD_TESTING=NO -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUSE_OPENMP=ON -DWITH_EXAMPLES=NO"
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DFYPP_EXECUTABLE=${FYPP_EXE}"
|
||||
if [ "${with_libxsmm}" == "__DONTUSE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXSMM=OFF"
|
||||
CMAKE_OPTIONS="-DBUILD_TESTING=NO -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUSE_OPENMP=ON"
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_EXAMPLES=NO -DFYPP_EXECUTABLE=${FYPP_EXE}"
|
||||
if [ "${with_libxsmm}" != "__DONTUSE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXSMM=ON"
|
||||
fi
|
||||
if [ "${with_libxs}" != "__DONTUSE__" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_LIBXS=ON"
|
||||
fi
|
||||
if [ "${MPI_MODE}" == "no" ]; then
|
||||
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DUSE_MPI=OFF"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue