Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .ci/spack_packages/c_lime/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack_repo.builtin.build_systems import cmake
from spack_repo.builtin.build_systems.cmake import CMakePackage, generator

from spack.package import *


class CLime(CMakePackage):
"""LIME (which can stand for Lattice QCD Interchange Message Encapsulation
or more generally, Large Internet Message Encapsulation) is a simple
packaging scheme for combining records containing ASCII and/or binary
data."""

homepage = "https://usqcd-software.github.io/c-lime/"
url = "https://github.com/usqcd-software/c-lime/archive/qio2-3-9.tar.gz"
git = "https://github.com/usqcd-software/c-lime.git"

license("GPL-2.0-or-later")

version(
"2-3-9",
sha256="7b9aeadd4dfec50e24da3e7e729f56abf95c9192612c41515fe27b2158773aac",
)
version("master", branch="master")

variant("pic", default=True, description="Enable position independent code")
variant("shared", default=True, description="Enable shared libraries")

depends_on("c", type="build") # generated


class CMakeBuilder(cmake.CMakeBuilder):
def cmake_args(self):
args = [
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
]
return args
15 changes: 11 additions & 4 deletions .ci/spack_packages/lemonio/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,29 @@

from spack.package import *


class Lemonio(CMakePackage):
"""LEMON: Lightweight Parallel I/O library for Lattice QCD."""

homepage = "https://github.com/etmc/lemon"
git = "https://github.com/etmc/lemon.git"
git = "https://github.com/etmc/lemon.git"
license("GPL-3.0-or-later")

version('master', branch='master')
version("master", branch="master")

variant("pic", default=True, description="Enable position independent code")
variant("shared", default=False, description="Enable sahred libraries")

depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build")

depends_on('mpi')
depends_on("mpi")
generator("ninja")

def configure_args(self):
args = []
args = [
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
]
return args
2 changes: 1 addition & 1 deletion .ci/spack_packages/tmlqcd/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Tmlqcd(CMakePackage, CudaPackage, ROCmPackage):
conflicts("+cuda +rocm", msg="CUDA and ROCm support are mutually exclusive")

# hard dependencies
depends_on("c-lime")
depends_on("c-lime@master")
depends_on("blas")
depends_on("lapack")
depends_on("pkgconfig", type="build")
Expand Down
2 changes: 1 addition & 1 deletion .ci/uenv-recipes/tmlqcd/daint-gh200/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spack:
commit: releases/v1.1
packages:
repo: https://github.com/spack/spack-packages.git
#commit:
commit: 60ca28b3565975d530f7c4645cc25670b7365de2
modules: true
description: "tmLQCD dependencies for CSCS CI on GH200."
version: 2
44 changes: 29 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ foreach(
ROCM_PREFIX
CRAY_ROCM_DIR
ROCM_PATH)
if($ENV{${__var}})
list(APPEND CMAKE_PREFIX_PATH $ENV{__var})
if(DEFINED ENV{${__var}})
list(APPEND CMAKE_PREFIX_PATH $ENV{${__var}})
set(ROCM_PATH
$ENV{__var}
$ENV{${__var}}
CACHE PATH "Path to ROCm installation")
endif()
endforeach()
Expand Down Expand Up @@ -102,6 +102,7 @@ option(TM_USE_HALFSPINOR "Use a Dirac Op. with halfspinor exchange" ON)
option(TM_USE_QPHIX "Enable QPhiX" OFF)
option(TM_USE_SHMEM "Use shmem API" OFF)
option(TM_USE_QUDA "Enable QUDA support" OFF)
option(TM_USE_HDF5 "Enable HDF5 support" OFF)
option(TM_ENABLE_WARNINGS "Enable all warnings" ON)
option(TM_ENABLE_TESTS "Enable tests" OFF)
set(TM_QPHIX_SOALEN
Expand All @@ -115,18 +116,30 @@ cmake_dependent_option(
TM_NONBLOCKING_MPI "Use non-blocking MPI calls for spinor and gauge" ON
"TM_USE_MPI" OFF)

# need to do it properly. Just a place holder
cmake_dependent_option(
TM_MPI_DIMENSION "Use n dimensional parallelisation [default=4]" 4
"TM_USE_MPI" OFF)
# cmake_dependent_option always creates a BOOL cache variable, but this setting
# is string-valued (compared against "1".."4","X","XY","XYZ" below), so it must
# be declared as a plain STRING cache variable instead.
set(TM_MPI_DIMENSION
"4"
CACHE STRING "Use n dimensional parallelisation [default=4]")
set_property(
CACHE TM_MPI_DIMENSION
PROPERTY STRINGS
"1"
"2"
"3"
"4"
"X"
"XY"
"XYZ")

# HIP dependent options
cmake_dependent_option(TM_USE_CUDA_HIP "Enable CUDA support in HIP" OFF
"TM_USE_HIP" OFF)

# clime and lemon depend on MPI
cmake_dependent_option(TM_USE_LEMON "Use the lemon io library" OFF "TM_USE_MPI"
ON)
cmake_dependent_option(TM_USE_LEMON "Use the lemon io library" ON "TM_USE_MPI"
OFF)

# GPU dependent options
cmake_dependent_option(TM_USE_NVHPC "Enable Nvidia HPC toolkit" OFF
Expand All @@ -149,8 +162,8 @@ cmake_dependent_option(DDalphaAMG_ENABLE_TRACK_RES "Enable track res support"
ON "TM_USE_DDalphaAMG" OFF)

cmake_dependent_option(
DDalphaAMG_ENABLE_SINGLE_ALLREDUCE_ARNOLDI OFF
"Enable paramount output support" OFF "TM_USE_DDalphaAMG" OFF)
DDalphaAMG_ENABLE_SINGLE_ALLREDUCE_ARNOLDI
"Enable single all-reduce Arnoldi support" OFF "TM_USE_DDalphaAMG" OFF)

cmake_dependent_option(
DDalphaAMG_ENABLE_COARSE_RES "Enable paramount output support" OFF
Expand Down Expand Up @@ -248,7 +261,7 @@ if(TM_USE_LEMON)
FetchContent_Declare(
lemon
GIT_REPOSITORY https://github.com/etmc/lemon
GIT_TAG 52cc2bf9cf9ac6f8f9566e9625dced3bccd40b43
GIT_TAG e40cda10d18284795f840a04ecbb4d63007fee3d
FIND_PACKAGE_ARGS NAMES lemon)
FetchContent_MakeAvailable(lemon)
endif()
Expand All @@ -261,13 +274,13 @@ if(TM_USE_QUDA)
endif()

if(TM_USE_SHMEM)
message(INFO "SHMEM needs to be included")
message(STATUS "SHMEM needs to be included")
endif()

if(TM_USE_CUDA AND TM_USE_HIP)
message(
ERROR
"HIP and CUDA are mutually exclusive. Please choose one GPU support only")
FATAL_ERROR
"HIP and CUDA are mutually exclusive. Please choose one GPU support only")
endif()

if(TM_USE_CUDA OR QUDA_TARGET_CUDA)
Expand Down Expand Up @@ -399,6 +412,7 @@ endif()
configure_file(cmake/git_hash.c.in git_hash.c @ONLY)
add_subdirectory(src/lib)
add_subdirectory(src/bin)
add_subdirectory(tests)

write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/tmLQCDConfigVersion.cmake"
Expand Down
9 changes: 8 additions & 1 deletion DDalphaAMG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

include(GNUInstallDirs)

if(DDalphaAMG_ENABLE_HDF5)
# the static hdf5-static target's link interface requires ZLIB::ZLIB
find_package(ZLIB)
find_package(HDF5 REQUIRED COMPONENTS C CONFIG)
endif()

set(DDalphaAMG_SRC_DIR ${CMAKE_SOURCE_DIR}/DDalphaAMG/deps)

FetchContent_Declare(
Expand Down Expand Up @@ -165,7 +171,8 @@ add_dependencies(DDalphaAMG run_sed)

target_link_libraries(
DDalphaAMG
PUBLIC MPI::MPI_C $<$<BOOL:${DDalphaAMG_ENABLE_HDF5}>:hdf5:hdf5>
PUBLIC MPI::MPI_C
$<$<BOOL:${DDalphaAMG_ENABLE_HDF5}>:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,hdf5-shared,hdf5-static>>
$<$<BOOL:${DDalphaAMG_ENABLE_OMP}>:OpenMP::OpenMP_C> tmlqcd::clime)

target_include_directories(
Expand Down
7 changes: 6 additions & 1 deletion cmake/DDalphaAMGConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.23)

if (NOT TARGET DDalphaAMG::DDalphaAMG)


include(CMakeFindDependencyMacro)

find_dependency(MPI REQUIRED)

if (@DDalphaAMG_ENABLE_PARAMOUNT_OUTPUT@)
Expand Down Expand Up @@ -43,6 +45,9 @@ if (NOT TARGET DDalphaAMG::DDalphaAMG)

if (@DDalphaAMG_ENABLE_HDF5@)
set(DDalphaAMG_ENABLE_HDF5 @DDalphaAMG_ENABLE_HDF5@)
# the static hdf5-static target's link interface requires ZLIB::ZLIB
find_dependency(ZLIB)
find_dependency(HDF5 COMPONENTS C CONFIG)
endif()


Expand Down
7 changes: 7 additions & 0 deletions cmake/tmLQCDConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.23)

if (NOT TARGET tmlqcd::tmlqcd)

include(CMakeFindDependencyMacro)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" ${CMAKE_MODULE_PATH})

# pass REQUIRED or QUIET depending on top Config call
Expand Down Expand Up @@ -32,6 +34,11 @@ if (NOT TARGET tmlqcd::tmlqcd)
find_package(CLime REQUIRED)
set(TM_USE_LIME ON)

if(@TM_USE_CUDA@)
set(TM_USE_CUDA @TM_USE_CUDA@)
find_dependency(CUDAToolkit)
endif()

if(@TM_USE_QUDA@)
set(TM_USE_QUDA @TM_USE_QUDA@)
find_package(QUDA REQUIRED config)
Expand Down
22 changes: 11 additions & 11 deletions src/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
list(APPEND tmlqcd_prog "invert;benchmark;deriv_mg_tune;hmc_tm;offline_measurement")
list(APPEND tmlqcd_prog
"invert;benchmark;deriv_mg_tune;hmc_tm;offline_measurement")

include_directories(
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
Expand All @@ -18,23 +19,22 @@ foreach(_prog ${tmlqcd_prog})
LINKER_LANGUAGE "CXX")
endforeach()

# check_locallity; compilation failure scalar_prod_r_test: compilation error
# header file missing test_eigenvalues: observables.h missing
if(TM_ENABLE_TESTS)
list(
APPEND
tmlqcd_test_prog
"check_locallity.c;hopping_test.cscalar_prod_r_test.c;test_eigenvalues.c;test_lemon.c"
)
list(APPEND tmlqcd_test_prog "hopping_test")
if(TM_USE_LEMON)
list(APPEND tmlqcd_test_prog test_lemon.c)
list(APPEND tmlqcd_test_prog "test_lemon")
endif()
if(TN_USE_QPHIX)
list(APPEND tmlqcd_test_prog qphix_test_Dslash.c)
if(TM_USE_QPHIX)
list(APPEND tmlqcd_test_prog "qphix_test_Dslash")
endif()

foreach(_prog ${tmlqcd_test_prog})
add_executable(${_prog} "${CMAKE_SOURCE_DIR}/src/bin/tests/${_prog}.c")

target_link_libraries(${_prog} PUBLIC hmc)
target_include_directories(${_prog}
PUBLIC "${CMAKE_SOURCE_DIR}/src/lib/test")
target_link_libraries(${_prog} PUBLIC tmlqcd)
set_target_properties(
${_prog}
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
Expand Down
11 changes: 5 additions & 6 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ target_link_libraries(
$<$<BOOL:${TM_USE_LEMON}>:lemon::lemon>
${LAPACK_LIBRARIES}
${BLAS_LIBRARIES}
$<$<BOOL:${TM_USE_MPI}>:MPI::MPI_C
MPI::MPI_CXX>
$<$<BOOL:${TM_USE_OMP}>:OpenMP::OpenMP_C
OpenMP::OpenMP_CXX>
$<$<BOOL:${TM_USE_MPI}>:MPI::MPI_C>
$<$<BOOL:${TM_USE_MPI}>:MPI::MPI_CXX>
$<$<BOOL:${TM_USE_OMP}>:OpenMP::OpenMP_C>
$<$<BOOL:${TM_USE_OMP}>:OpenMP::OpenMP_CXX>
m)

target_compile_definitions(
Expand All @@ -449,8 +449,7 @@ install(

install(FILES "${CMAKE_SOURCE_DIR}/src/lib/include/tmLQCD.h"
"${CMAKE_SOURCE_DIR}/src/lib/include/tmlqcd_config.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
)
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")

install(FILES "${CMAKE_BINARY_DIR}/tmlqcd_config_internal.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
Loading
Loading