From e7e05fc13706e5da433a8a087a1a8d0fe5364286 Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Tue, 22 Sep 2026 11:28:44 +0200 Subject: [PATCH 1/3] Add cmake path hint for openblas to ensure find_package looks in the right places --- cmake/BuildSystem.md | 2 + cmake/KokkosKernelsDependency.cmake | 117 ++++++++++++++++++---------- 2 files changed, 80 insertions(+), 39 deletions(-) diff --git a/cmake/BuildSystem.md b/cmake/BuildSystem.md index 1c80f4e17..23281d878 100644 --- a/cmake/BuildSystem.md +++ b/cmake/BuildSystem.md @@ -201,6 +201,8 @@ The following CMake cache variables control this support: Installed dependencies can be selected with `KokkosKernels_DIR`, `LAPACKE_ROOT`, `LAPACKE_INCLUDE_DIRS`, `LAPACKE_LIBRARY_DIRS`, `LAPACKE_LIBRARIES`, or `MKL_DIR`. +Providers that nest their headers under `/include/openblas/` (such as +OpenBLAS) are found automatically when the prefix is on `CMAKE_PREFIX_PATH`. `LAPACKE_LIBRARIES` is a semicolon-separated complete link line and may contain absolute paths, library names, imported targets, and linker items such as `-lm`. The standard FetchContent overrides `FETCHCONTENT_SOURCE_DIR_KOKKOSKERNELS` and diff --git a/cmake/KokkosKernelsDependency.cmake b/cmake/KokkosKernelsDependency.cmake index c9f0191b6..c09064b42 100644 --- a/cmake/KokkosKernelsDependency.cmake +++ b/cmake/KokkosKernelsDependency.cmake @@ -1,5 +1,5 @@ -# Resolve host eigenanalysis independently of CUDA/HIP acceleration. -# This module is included only when IPPL_ENABLE_KOKKOS_KERNELS is enabled. +# Resolve host eigenanalysis independently of CUDA/HIP acceleration. This module is included only +# when IPPL_ENABLE_KOKKOS_KERNELS is enabled. include(CheckCXXSourceCompiles) include(CheckCXXSourceRuns) include(CMakePushCheckState) @@ -7,7 +7,8 @@ option(IPPL_FETCH_LAPACKE "Build reference LAPACKE when no installation is found set(IPPL_HOST_LAPACK_FETCHED OFF) set(KokkosKernels_VERSION "5.2.0" CACHE STRING "Kokkos Kernels release or git.tag/sha") -set(IPPL_KOKKOS_KERNELS_HOST "LAPACKE" CACHE STRING "Host eigenanalysis provider: LAPACKE, MKL, NONE") +set(IPPL_KOKKOS_KERNELS_HOST "LAPACKE" CACHE STRING + "Host eigenanalysis provider: LAPACKE, MKL, NONE") set_property(CACHE IPPL_KOKKOS_KERNELS_HOST PROPERTY STRINGS LAPACKE MKL NONE) set(IPPL_LAPACK_INTEGER_BYTES "4" CACHE STRING "Host LAPACK integer size: 4 (LP64) or 8 (ILP64)") set_property(CACHE IPPL_LAPACK_INTEGER_BYTES PROPERTY STRINGS 4 8) @@ -20,8 +21,8 @@ endif() extract_git_label(KokkosKernels_VERSION _ipplKernelsGit) if(NOT TARGET Kokkos::kokkoskernels AND NOT _ipplKernelsGit) - # Its config checks Kokkos_FOUND, whereas IPPL may have built Kokkos in-tree. - # Keep the already selected target instead of searching for another Kokkos. + # Its config checks Kokkos_FOUND, whereas IPPL may have built Kokkos in-tree. Keep the already + # selected target instead of searching for another Kokkos. set(_ipplKokkosFound "${Kokkos_FOUND}") set(Kokkos_FOUND TRUE) find_package(KokkosKernels ${KokkosKernels_VERSION} CONFIG QUIET) @@ -35,17 +36,22 @@ if(NOT TARGET Kokkos::kokkoskernels) if(IPPL_KOKKOS_KERNELS_HOST STREQUAL "LAPACKE") set(KokkosKernels_ENABLE_TPL_LAPACKE ON CACHE BOOL "Host LAPACKE" FORCE) find_path(IPPL_LAPACKE_INCLUDE_DIR lapacke.h - HINTS ${LAPACKE_INCLUDE_DIRS} ${LAPACKE_ROOT}/include $ENV{LAPACKE_ROOT}/include) + HINTS ${LAPACKE_INCLUDE_DIRS} ${LAPACKE_ROOT}/include $ENV{LAPACKE_ROOT}/include + PATH_SUFFIXES openblas) if(LAPACKE_LIBRARIES) # An explicit link line is authoritative. Never mix it with fetched headers. if(NOT IPPL_LAPACKE_INCLUDE_DIR) - message(FATAL_ERROR "LAPACKE_LIBRARIES was supplied but lapacke.h was not found. Set LAPACKE_INCLUDE_DIRS or LAPACKE_ROOT, or clear LAPACKE_LIBRARIES to permit the fallback.") + message( + FATAL_ERROR + "LAPACKE_LIBRARIES was supplied but lapacke.h was not found. Set LAPACKE_INCLUDE_DIRS or LAPACKE_ROOT, or clear LAPACKE_LIBRARIES to permit the fallback." + ) endif() set(LAPACKE_INCLUDE_DIRS "${IPPL_LAPACKE_INCLUDE_DIR}") else() - find_library(IPPL_LAPACKE_LIBRARY NAMES lapacke openblas - HINTS ${LAPACKE_LIBRARY_DIRS} ${LAPACKE_ROOT}/lib ${LAPACKE_ROOT}/lib64 - $ENV{LAPACKE_ROOT}/lib $ENV{LAPACKE_ROOT}/lib64) + find_library( + IPPL_LAPACKE_LIBRARY NAMES lapacke openblas + HINTS ${LAPACKE_LIBRARY_DIRS} ${LAPACKE_ROOT}/lib ${LAPACKE_ROOT}/lib64 + $ENV{LAPACKE_ROOT}/lib $ENV{LAPACKE_ROOT}/lib64) if(IPPL_LAPACKE_INCLUDE_DIR AND IPPL_LAPACKE_LIBRARY) set(BLA_SIZEOF_INTEGER "${IPPL_LAPACK_INTEGER_BYTES}") find_package(LAPACK QUIET) @@ -57,7 +63,10 @@ if(NOT TARGET Kokkos::kokkoskernels) include(FetchHostLapack) ippl_fetch_host_lapack() else() - message(FATAL_ERROR "Host LAPACKE was not found and IPPL_FETCH_LAPACKE=OFF. Set LAPACKE_ROOT or supply LAPACKE_INCLUDE_DIRS and LAPACKE_LIBRARIES.") + message( + FATAL_ERROR + "Host LAPACKE was not found and IPPL_FETCH_LAPACKE=OFF. Set LAPACKE_ROOT or supply LAPACKE_INCLUDE_DIRS and LAPACKE_LIBRARIES." + ) endif() endif() elseif(IPPL_KOKKOS_KERNELS_HOST STREQUAL "MKL") @@ -72,25 +81,25 @@ if(NOT TARGET Kokkos::kokkoskernels) foreach(_backend CUBLAS CUSOLVER CUSPARSE ROCBLAS ROCSOLVER ROCSPARSE) set(_enabled OFF) - if(("CUDA" IN_LIST IPPL_PLATFORMS AND _backend MATCHES "^CU") OR - ("HIP" IN_LIST IPPL_PLATFORMS AND _backend MATCHES "^ROC")) + if(("CUDA" IN_LIST IPPL_PLATFORMS AND _backend MATCHES "^CU") OR ("HIP" IN_LIST IPPL_PLATFORMS + AND _backend MATCHES "^ROC")) set(_enabled ON) endif() - set(KokkosKernels_ENABLE_TPL_${_backend} ${_enabled} CACHE BOOL "IPPL GPU linear algebra backend" FORCE) + set(KokkosKernels_ENABLE_TPL_${_backend} ${_enabled} + CACHE BOOL "IPPL GPU linear algebra backend" FORCE) endforeach() # Avoid the considerable ETI build cost by instantiating only kernels used by IPPL. set(KokkosKernels_ADD_DEFAULT_ETI OFF CACHE BOOL "Preinstantiate default Kokkos Kernels types") - set(KokkosKernels_ENABLE_SUPERNODAL_SPTRSV OFF CACHE BOOL "Supernodal solver requires LayoutLeft ETI") + set(KokkosKernels_ENABLE_SUPERNODAL_SPTRSV OFF CACHE BOOL + "Supernodal solver requires LayoutLeft ETI") if(NOT _ipplKernelsGit) set(_ipplKernelsGit "${KokkosKernels_VERSION}") endif() - FetchContent_Declare(KokkosKernels - GIT_REPOSITORY https://github.com/kokkos/kokkos-kernels.git - GIT_TAG ${_ipplKernelsGit}) - # Upstream uses pre-CMP0126 cache semantics and otherwise replaces inherited - # discovery results with empty cache defaults. Seed them only for its configure, - # then restore the user's cache so automatic fallback values do not become - # authoritative user overrides on the next configure. + FetchContent_Declare(KokkosKernels GIT_REPOSITORY https://github.com/kokkos/kokkos-kernels.git + GIT_TAG ${_ipplKernelsGit}) + # Upstream uses pre-CMP0126 cache semantics and otherwise replaces inherited discovery results + # with empty cache defaults. Seed them only for its configure, then restore the user's cache so + # automatic fallback values do not become authoritative user overrides on the next configure. foreach(_variable LAPACKE_INCLUDE_DIRS LAPACKE_LIBRARIES) get_property(_saved${_variable} CACHE ${_variable} PROPERTY VALUE) get_property(_had${_variable} CACHE ${_variable} PROPERTY TYPE SET) @@ -105,8 +114,8 @@ if(NOT TARGET Kokkos::kokkoskernels) endif() endforeach() # Upstream installs an export but does not provide a build-tree export. - export(EXPORT KokkosKernelsTargets - FILE "${kokkoskernels_BINARY_DIR}/KokkosKernelsTargets.cmake" NAMESPACE Kokkos::) + export(EXPORT KokkosKernelsTargets FILE "${kokkoskernels_BINARY_DIR}/KokkosKernelsTargets.cmake" + NAMESPACE Kokkos::) set(IPPL_KOKKOS_KERNELS_PACKAGE_HINT "${kokkoskernels_BINARY_DIR}") set(IPPL_KOKKOS_KERNELS_FETCHED ON) else() @@ -114,8 +123,8 @@ else() set(IPPL_KOKKOS_KERNELS_FETCHED OFF) endif() -# Find the actual generated configuration header: inspect the target, not the -# user's cache options, which cannot enable features in an installed package. +# Find the actual generated configuration header: inspect the target, not the user's cache options, +# which cannot enable features in an installed package. get_target_property(_kernelIncludes Kokkos::kokkoskernels INTERFACE_INCLUDE_DIRECTORIES) set(_kernelConfig) foreach(_include IN LISTS _kernelIncludes) @@ -130,7 +139,16 @@ if(NOT _kernelConfig) message(FATAL_ERROR "Cannot locate KokkosKernels_config.h on Kokkos::kokkoskernels") endif() file(READ "${_kernelConfig}" _kernelConfiguration) -foreach(_backend IN ITEMS LAPACKE MKL CUBLAS CUSOLVER CUSPARSE ROCBLAS ROCSOLVER ROCSPARSE) +foreach( + _backend IN + ITEMS LAPACKE + MKL + CUBLAS + CUSOLVER + CUSPARSE + ROCBLAS + ROCSOLVER + ROCSPARSE) set(_has${_backend} OFF) if(_kernelConfiguration MATCHES "#define KOKKOSKERNELS_ENABLE_TPL_${_backend}([ \t\r\n]|$)") set(_has${_backend} ON) @@ -138,15 +156,19 @@ foreach(_backend IN ITEMS LAPACKE MKL CUBLAS CUSOLVER CUSPARSE ROCBLAS ROCSOLVER endforeach() set(IPPL_KOKKOS_KERNELS_NEEDS_MKL ${_hasMKL}) if(_hasMKL) - # Modern upstream MKL exports reference MKL::MKL, including when host - # eigenanalysis was disabled in IPPL but the external package still uses MKL. + # Modern upstream MKL exports reference MKL::MKL, including when host eigenanalysis was disabled + # in IPPL but the external package still uses MKL. find_package(MKL CONFIG REQUIRED) endif() foreach(_platform CUDA HIP) if(_platform IN_LIST IPPL_PLATFORMS) - if((_platform STREQUAL "CUDA" AND (NOT _hasCUBLAS OR NOT _hasCUSOLVER OR NOT _hasCUSPARSE)) OR - (_platform STREQUAL "HIP" AND (NOT _hasROCBLAS OR NOT _hasROCSOLVER OR NOT _hasROCSPARSE))) - message(FATAL_ERROR "Selected Kokkos Kernels lacks the required ${_platform} BLAS/solver TPLs. Rebuild it with the matching backend.") + if((_platform STREQUAL "CUDA" AND (NOT _hasCUBLAS OR NOT _hasCUSOLVER OR NOT _hasCUSPARSE)) + OR (_platform STREQUAL "HIP" AND (NOT _hasROCBLAS OR NOT _hasROCSOLVER OR NOT _hasROCSPARSE) + )) + message( + FATAL_ERROR + "Selected Kokkos Kernels lacks the required ${_platform} BLAS/solver TPLs. Rebuild it with the matching backend." + ) endif() endif() endforeach() @@ -154,7 +176,10 @@ endforeach() set(IPPL_KOKKOS_KERNELS_EIGENANALYSIS OFF) if(NOT IPPL_KOKKOS_KERNELS_HOST STREQUAL "NONE") if(NOT _has${IPPL_KOKKOS_KERNELS_HOST}) - message(FATAL_ERROR "Selected Kokkos Kernels lacks ${IPPL_KOKKOS_KERNELS_HOST}. Rebuild it with this host TPL, or select IPPL_KOKKOS_KERNELS_HOST=NONE.") + message( + FATAL_ERROR + "Selected Kokkos Kernels lacks ${IPPL_KOKKOS_KERNELS_HOST}. Rebuild it with this host TPL, or select IPPL_KOKKOS_KERNELS_HOST=NONE." + ) endif() set(_integerDefinition) if(IPPL_LAPACK_INTEGER_BYTES STREQUAL "8") @@ -181,7 +206,8 @@ if(NOT IPPL_KOKKOS_KERNELS_HOST STREQUAL "NONE") get_target_property(_hostIncludes LAPACKE INTERFACE_INCLUDE_DIRECTORIES) set_target_properties(ippl_lapacke_probe PROPERTIES INTERFACE_LINK_LIBRARIES "${_hostLinks}") if(_hostIncludes) - set_target_properties(ippl_lapacke_probe PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_hostIncludes}") + set_target_properties(ippl_lapacke_probe PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${_hostIncludes}") endif() set(CMAKE_REQUIRED_LIBRARIES ippl_lapacke_probe) else() @@ -196,7 +222,8 @@ if(NOT IPPL_KOKKOS_KERNELS_HOST STREQUAL "NONE") endif() # Recheck after provider/path changes rather than retaining a stale success. unset(IPPL_HOST_EIGEN_LINKS CACHE) - set(_hostEigenProbe " + set(_hostEigenProbe + " #include <${_header}> #include static_assert(sizeof(lapack_int) == ${IPPL_LAPACK_INTEGER_BYTES}, \"LAPACK integer ABI mismatch\"); @@ -215,15 +242,27 @@ if(NOT IPPL_KOKKOS_KERNELS_HOST STREQUAL "NONE") unset(IPPL_HOST_EIGEN_RUNS CACHE) check_cxx_source_runs("${_hostEigenProbe}" IPPL_HOST_EIGEN_RUNS) if(NOT IPPL_HOST_EIGEN_RUNS) - message(FATAL_ERROR "Host LAPACKE linked but failed the eigenvalue/ABI smoke test. Check the selected libraries and integer interface.") + message( + FATAL_ERROR + "Host LAPACKE linked but failed the eigenvalue/ABI smoke test. Check the selected libraries and integer interface." + ) endif() elseif(CMAKE_CROSSCOMPILING) - message(STATUS "Cross-compiling: host LAPACKE compile/link checked; runtime ABI validation deferred to unit tests") + message( + STATUS + "Cross-compiling: host LAPACKE compile/link checked; runtime ABI validation deferred to unit tests" + ) endif() cmake_pop_check_state() if(NOT IPPL_HOST_EIGEN_LINKS) - message(FATAL_ERROR "Host LAPACKE eigenanalysis failed to compile/link. Check matching headers, LP64/ILP64 libraries, and all static dependencies (including Fortran runtime). See CMake configure log.") + message( + FATAL_ERROR + "Host LAPACKE eigenanalysis failed to compile/link. Check matching headers, LP64/ILP64 libraries, and all static dependencies (including Fortran runtime). See CMake configure log." + ) endif() set(IPPL_KOKKOS_KERNELS_EIGENANALYSIS ON) endif() -message(STATUS "IPPL Kokkos Kernels: host=${IPPL_KOKKOS_KERNELS_HOST}, eigenanalysis=${IPPL_KOKKOS_KERNELS_EIGENANALYSIS}") +message( + STATUS + "IPPL Kokkos Kernels: host=${IPPL_KOKKOS_KERNELS_HOST}, eigenanalysis=${IPPL_KOKKOS_KERNELS_EIGENANALYSIS}" +) From 30d721c10e7b0132b9290c001462206324c069ae Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Tue, 22 Sep 2026 12:37:04 +0200 Subject: [PATCH 2/3] Fix some cmake logic and #ifdefs to prevent catalyst build errors in CI --- cmake/Dependencies.cmake | 30 ++++++++++++------------------ demos/fel/CMakeLists.txt | 8 +++++--- demos/fel/Config.h | 21 ++++++++++++++++----- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 4c78c3c28..544e141f2 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -493,7 +493,7 @@ endif() # ------------------------------------------------------------------------------ # Catalyst (libcatalyst SDK and bundled Conduit parser) # ------------------------------------------------------------------------------ -if(IPPL_ENABLE_CATALYST OR IPPL_ENABLE_FEL) +if(IPPL_ENABLE_CATALYST) enable_language(C) if(NOT Catalyst_VERSION) @@ -514,17 +514,16 @@ if(IPPL_ENABLE_CATALYST OR IPPL_ENABLE_FEL) endforeach() unset(_cat_dir_var) - # Do not mistake the package generated by an earlier FetchContent configure - # for a user-provided Catalyst installation on a subsequent configure. + # Do not mistake the package generated by an earlier FetchContent configure for a user-provided + # Catalyst installation on a subsequent configure. set(_ippl_reuse_fetched_catalyst OFF) set(_ippl_catalyst_dir_is_in_build_tree OFF) if(catalyst_DIR) cmake_path(IS_PREFIX CMAKE_BINARY_DIR "${catalyst_DIR}" NORMALIZE _ippl_catalyst_dir_is_in_build_tree) endif() - if(NOT Catalyst_DIR AND NOT CATALYST_DIR - AND (_ippl_catalyst_dir_is_in_build_tree - OR (IPPL_CATALYST_FETCHED AND NOT catalyst_DIR))) + if(NOT Catalyst_DIR AND NOT CATALYST_DIR AND (_ippl_catalyst_dir_is_in_build_tree + OR (IPPL_CATALYST_FETCHED AND NOT catalyst_DIR))) set(_ippl_reuse_fetched_catalyst ON) unset(catalyst_DIR CACHE) unset(catalyst_FOUND) @@ -556,22 +555,18 @@ if(IPPL_ENABLE_CATALYST OR IPPL_ENABLE_FEL) set(CATALYST_WITH_EXTERNAL_CONDUIT OFF CACHE BOOL "" FORCE) set(CATALYST_USE_MPI ON CACHE BOOL "" FORCE) - FetchContent_Declare( - catalyst - GIT_REPOSITORY "https://gitlab.kitware.com/paraview/catalyst.git" - GIT_TAG "${CATALYST_VERSION_GIT}" - DOWNLOAD_EXTRACT_TIMESTAMP ON) + FetchContent_Declare(catalyst GIT_REPOSITORY "https://gitlab.kitware.com/paraview/catalyst.git" + GIT_TAG "${CATALYST_VERSION_GIT}" DOWNLOAD_EXTRACT_TIMESTAMP ON) FetchContent_MakeAvailable(catalyst) if(NOT TARGET catalyst::catalyst) message(FATAL_ERROR "Catalyst FetchContent did not provide catalyst::catalyst") endif() - file( - STRINGS "${catalyst_SOURCE_DIR}/CMakeLists.txt" _catalyst_project_line - REGEX "^[ \t]*project\\(CATALYST VERSION [0-9]+\\.[0-9]+") - string(REGEX MATCH "VERSION[ \t]+([0-9]+\\.[0-9]+(\\.[0-9]+)?)" - _catalyst_version_match "${_catalyst_project_line}") + file(STRINGS "${catalyst_SOURCE_DIR}/CMakeLists.txt" _catalyst_project_line + REGEX "^[ \t]*project\\(CATALYST VERSION [0-9]+\\.[0-9]+") + string(REGEX MATCH "VERSION[ \t]+([0-9]+\\.[0-9]+(\\.[0-9]+)?)" _catalyst_version_match + "${_catalyst_project_line}") if(NOT CMAKE_MATCH_1) message(FATAL_ERROR "Could not determine the fetched Catalyst project version") endif() @@ -581,8 +576,7 @@ if(IPPL_ENABLE_CATALYST OR IPPL_ENABLE_FEL) unset(_catalyst_version_match) endif() - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _catalyst_major_minor - "${IPPL_CATALYST_VERSION}") + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _catalyst_major_minor "${IPPL_CATALYST_VERSION}") if(NOT _catalyst_major_minor) message(FATAL_ERROR "Could not determine Catalyst's major/minor version") endif() diff --git a/demos/fel/CMakeLists.txt b/demos/fel/CMakeLists.txt index 39a8b87d7..efd347b1a 100644 --- a/demos/fel/CMakeLists.txt +++ b/demos/fel/CMakeLists.txt @@ -21,9 +21,11 @@ add_custom_command( add_custom_target(ippl_fel_config DEPENDS "${IPPL_FEL_CONFIG_BUILD}") add_dependencies(FreeElectronLaser ippl_fel_config) -target_link_libraries( - FreeElectronLaser - PRIVATE IPPL::ippl catalyst::catalyst) +target_link_libraries(FreeElectronLaser PRIVATE IPPL::ippl) + +if(IPPL_ENABLE_CATALYST) + target_link_libraries(FreeElectronLaser PRIVATE catalyst::catalyst) +endif() target_include_directories(FreeElectronLaser PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(FreeElectronLaser SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/stb) diff --git a/demos/fel/Config.h b/demos/fel/Config.h index 87136a1f4..5d473d4d9 100644 --- a/demos/fel/Config.h +++ b/demos/fel/Config.h @@ -8,7 +8,6 @@ // FreeElectronLaser.cpp. #include -#include #include #include #include @@ -22,6 +21,9 @@ #include "Types/Vector.h" #include "units.h" +#ifdef IPP_ENABLE_CATALYST +#include +#endif struct config { using scalar = double; @@ -61,6 +63,7 @@ struct config { namespace fel_config_detail { +#ifdef IPPL_ENABLE_CATALYST inline conduit_cpp::Node requiredNode(const conduit_cpp::Node& root, const std::string& path) { if (!root.has_path(path)) { throw std::runtime_error("Missing required configuration value '" + path + "'"); @@ -167,6 +170,7 @@ namespace fel_config_detail { } return result; } +#endif } // namespace fel_config_detail @@ -237,6 +241,8 @@ inline std::string lowercase_singular(std::string str) { return str; } + +#ifdef IPPL_ENABLE_CATALYST inline double get_time_multiplier(const conduit_cpp::Node& root) { const std::string time_scale = fel_config_detail::requiredString(root, "mesh/time-scale"); std::string time_scale_string = lowercase_singular(time_scale); @@ -318,7 +324,7 @@ inline config read_config(const char* filepath) { ? fel_config_detail::requiredNumber(root, "timestep-ratio") : config::scalar(1); ret.total_time = fel_config_detail::requiredNumber(root, "mesh/total-time") * tmult - / unit_time_in_seconds; + / unit_time_in_seconds; ret.space_charge = fel_config_detail::requiredNumber(root, "mesh/space-charge") != config::scalar(0); ret.bunch_gamma = fel_config_detail::requiredNumber(root, "bunch/gamma"); @@ -344,11 +350,11 @@ inline config read_config(const char* filepath) { ret.length_scale_in_jobfile = lmult; ret.temporal_scale_in_jobfile = tmult; ret.charge = fel_config_detail::requiredNumber(root, "bunch/charge") - * electron_charge_in_unit_charges; + * electron_charge_in_unit_charges; ret.mass = fel_config_detail::requiredNumber(root, "bunch/mass") * electron_mass_in_unit_masses; - ret.num_particles = fel_config_detail::requiredInteger( - root, "bunch/number-of-particles"); + ret.num_particles = + fel_config_detail::requiredInteger(root, "bunch/number-of-particles"); ret.mean_position = fel_config_detail::getVector(root, "bunch/position") * lmult / unit_length_in_meters; ret.sigma_position = @@ -389,5 +395,10 @@ inline config read_config(const char* filepath) { + "': " + error.what()); } } +#else +inline config read_config(const char* filepath) { + return {}; +} +#endif #endif From 2d102df7ee23245a5957baeb4e25a9a4cdd1c903 Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Wed, 23 Sep 2026 13:05:42 +0200 Subject: [PATCH 3/3] Cleanup CMake Presets and rename preset file --- CMakePresets.json | 94 +++++++++++++++++++++++++ CMakeUserPresets.json | 155 ------------------------------------------ 2 files changed, 94 insertions(+), 155 deletions(-) create mode 100644 CMakePresets.json delete mode 100644 CMakeUserPresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..ce20c57f6 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,94 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 24, + "patch": 0 + }, + "configurePresets": [ + { + "name": "testing", + "hidden": true, + "cacheVariables": { + "IPPL_ENABLE_TESTS": "ON", + "IPPL_ENABLE_UNIT_TESTS": "ON" + } + }, + { + "name": "default", + "displayName": "Default", + "description": "Default build, release mode with most common options", + "generator": "Unix Makefiles", + "cacheVariables": { + "BUILD_SHARED_LIBS": "ON", + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_POSITION_INDEPENDENT_CODE": "ON", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "Kokkos_VERSION_DEFAULT": "git.5.2.2", + "Heffte_VERSION_DEFAULT": "git.v2.4.1", + "IPPL_PLATFORMS": "SERIAL", + "IPPL_ENABLE_FFT": "ON", + "IPPL_ENABLE_ALPINE": "ON", + "IPPL_ENABLE_ESPIF": "ON", + "IPPL_ENABLE_COSMOLOGY": "ON", + "IPPL_ENABLE_COLLISIONS": "ON", + "IPPL_ENABLE_FEL": "ON", + "IPPL_ENABLE_UNIT_TESTS": "OFF", + "IPPL_USE_STANDARD_FOLDERS": "ON" + } + }, + { + "name": "release-testing", + "displayName": "Testing(Release)", + "description": "Enables building test in release mode", + "inherits": [ + "testing", + "default" + ] + }, + { + "name": "debug-testing", + "displayName": "Testing(Debug)", + "description": "Enables building test in debug mode", + "inherits": [ + "testing", + "default" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "alps-gh200", + "displayName": "Alps-GH200-defaults", + "description": "Settings for Alps GH200, with CUDA (release+testing)", + "inherits": [ + "release-testing" + ], + "cacheVariables": { + "CMAKE_CUDA_ARCHITECTURES": "90", + "MPIEXEC_EXECUTABLE": "/usr/bin/srun", + "MPIEXEC_PREFLAGS": "--gpus-per-task=1;/user-environment/wrapper-mpi.sh", + "OPALX_PLATFORMS": "CUDA;SERIAL" + } + }, + { + "name": "alps-mi300", + "displayName": "Alps-mi300-defaults", + "description": "Enables building test in debug mode", + "inherits": [ + "release-testing" + ], + "cacheVariables": { + "CMAKE_CXX_FLAGS": "--offload-arch=gfx942:sramecc+:xnack+", + "CMAKE_HIP_ARCHITECTURES": "gfx942", + "MPIEXEC_EXECUTABLE": "/usr/bin/srun", + "MPIEXEC_PREFLAGS": "--gpus-per-node=4;/user-environment/wrapper-mpi.sh", + "OPALX_PLATFORMS": "HIP;SERIAL", + "Kokkos_ARCH_AMD_GFX942_APU": "ON", + "KOKKOS_AMDGPU_OPTIONS": "--offload-arch=gfx942:sramecc+:xnack+" + } + } + ] +} diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json deleted file mode 100644 index e816ba6de..000000000 --- a/CMakeUserPresets.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "version": 3, - "cmakeMinimumRequired": { - "major": 3, - "minor": 24, - "patch": 0 - }, - "configurePresets": [ - { - "name": "testing", - "hidden": true, - "cacheVariables": { - "IPPL_ENABLE_TESTS": "ON", - "IPPL_ENABLE_UNIT_TESTS": "ON" - } - }, - { - "name": "default", - "displayName": "Default", - "description": "Default build, release mode with most common options", - "generator": "Unix Makefiles", - "cacheVariables": { - "BUILD_SHARED_LIBS": "ON", - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "Kokkos_VERSION_DEFAULT": "5.2.0", - "Heffte_VERSION_DEFAULT": "2.4.0", - "IPPL_PLATFORMS": "SERIAL", - "IPPL_ENABLE_FFT": "ON", - "IPPL_ENABLE_ALPINE": "ON", - "IPPL_ENABLE_ESPIF": "ON", - "IPPL_ENABLE_COSMOLOGY": "ON", - "IPPL_ENABLE_COLLISIONS": "ON", - "IPPL_ENABLE_FEL": "ON", - "IPPL_ENABLE_UNIT_TESTS": "OFF", - "IPPL_USE_STANDARD_FOLDERS": "ON" - } - }, - { - "name": "fetch", - "displayName": "ForceDownload", - "description": "Always downloads dependencies", - "inherits": [ - "default" - ], - "cacheVariables": { - "Kokkos_VERSION": "git.5.2.0", - "Heffte_VERSION": "git.v2.4.1" - } - }, - { - "name": "release-testing", - "displayName": "Testing(Release)", - "description": "Enables building test in release mode", - "inherits": [ - "testing", - "default" - ] - }, - { - "name": "debug-testing", - "displayName": "Testing(Debug)", - "description": "Enables building test in debug mode", - "inherits": [ - "testing", - "default" - ], - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "alps-gh200", - "displayName": "Alps-GH200-defaults", - "description": "Enables building test in debug mode", - "inherits": [ - "release-testing" - ], - "cacheVariables": { - "MPIEXEC_PREFLAGS": "--gpus-per-task=1;/user-environment/wrapper-mpi.sh", - "IPPL_PLATFORMS": "SERIAL;CUDA", - "CMAKE_CUDA_ARCHITECTURES": "90", - "MPIEXEC_EXECUTABLE": "/usr/bin/srun", - "Kokkos_VERSION_DEFAULT": "5.2.0", - "Heffte_VERSION_DEFAULT": "2.4.1" - } - }, - { - "name": "alps-mi300", - "displayName": "Alps-mi300-defaults", - "description": "Enables building test in debug mode", - "inherits": [ - "release-testing" - ], - "cacheVariables": { - "MPIEXEC_PREFLAGS": "--gpus-per-node=4;/user-environment/wrapper-mpi.sh", - "IPPL_PLATFORMS": "HIP;SERIAL", - "CMAKE_HIP_ARCHITECTURES": "gfx942", - "AMDGPU_TARGETS": "gfx942", - "GPU_TARGETS": "gfx942", - "MPIEXEC_EXECUTABLE": "/usr/bin/srun", - "CMAKE_POSITION_INDEPENDENT_CODE": "ON", - "CMAKE_CXX_STANDARD": "20", - "BUILD_SHARED_LIBS": "ON" - } - }, - { - "name": "alps-mi300-kokkos", - "displayName": "Alps-mi300-defaults", - "description": "Enables building test in debug mode", - "inherits": [ - "release-testing" - ], - "cacheVariables": { - "MPIEXEC_PREFLAGS": "--gpus-per-node=4;/user-environment/wrapper-mpi.sh", - "IPPL_PLATFORMS": "HIP;SERIAL", - "CMAKE_HIP_ARCHITECTURES": "gfx942", - "AMDGPU_TARGETS": "gfx942", - "GPU_TARGETS": "gfx942", - "MPIEXEC_EXECUTABLE": "/usr/bin/srun", - "Kokkos_VERSION_DEFAULT": "git.5.2.0", - "Heffte_VERSION_DEFAULT": "git.v2.4.1", - "CMAKE_POSITION_INDEPENDENT_CODE": "ON", - "CMAKE_CXX_STANDARD": "20", - "BUILD_SHARED_LIBS": "ON", - "CMAKE_CXX_COMPILER": "hipcc", - "Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE": "OFF", - "Kokkos_ARCH_ZEN3": "ON", - "Kokkos_ARCH_AMD_GFX942_APU": "ON", - "Kokkos_ENABLE_CUDA": "OFF", - "Kokkos_ENABLE_OPENMP": "OFF", - "Kokkos_ENABLE_THREADS": "OFF", - "Kokkos_ENABLE_SERIAL": "ON", - "Kokkos_ENABLE_HIP": "ON", - "Kokkos_ENABLE_SYCL": "OFF", - "Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION": "OFF", - "Kokkos_ENABLE_COMPILER_WARNINGS": "OFF", - "Kokkos_ENABLE_COMPLEX_ALIGN": "ON", - "Kokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE": "OFF", - "Kokkos_ENABLE_DEBUG": "OFF", - "Kokkos_ENABLE_DEBUG_BOUNDS_CHECK": "OFF", - "Kokkos_ENABLE_DEPRECATED_CODE": "OFF", - "Kokkos_ENABLE_EXAMPLES": "OFF", - "Kokkos_ENABLE_HPX_ASYNC_DISPATCH": "OFF", - "Kokkos_ENABLE_TUNING": "OFF", - "Kokkos_ENABLE_TESTS": "OFF", - "Kokkos_ENABLE_HPX": "OFF", - "Kokkos_ENABLE_HWLOC": "OFF", - "Kokkos_ENABLE_NUMACTL": "OFF", - "Kokkos_ENABLE_MEMKIND": "OFF", - "Kokkos_ENABLE_ROCTHRUST": "ON" - } - } - ] -}