From 44a10b9fed74a17fa593515f45226ec33c91cae6 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Sun, 23 Jun 2024 23:14:36 +0200 Subject: [PATCH 1/6] #354: Bump minimum CMake version to 3.23 and update find_package_local to work with packageName_ROOT --- CMakeLists.txt | 11 ++----- cmake/load_package.cmake | 71 +++++++++++----------------------------- 2 files changed, 23 insertions(+), 59 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c74c262..bc756454 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.23) project(checkpoint VERSION 1.4.0) include(cmake/turn_on_warnings.cmake) @@ -112,9 +112,7 @@ if (NOT kokkos_DISABLE) optional_pkg_directory(kokkos "Kokkos" 1) if (${kokkos_DIR_FOUND}) - find_package_local( - kokkos "${kokkos_DIR}/" Kokkos "CMake/Kokkos/" "cmake/Kokkos/" - ) + find_package_local(kokkos Kokkos) # Used to properly setup transitive dependency in checkpointConfig.cmake.in set(CHECKPOINT_HAS_KOKKOS_LIBRARY 1) else() @@ -127,10 +125,7 @@ if (NOT kokkos_kernels_DISABLE) optional_pkg_directory(KokkosKernels "Kokkos kernels" 1) if (KokkosKernels_DIR_FOUND) - find_package_local( - KokkosKernels "${KokkosKernels_DIR}/" KokkosKernels - "CMake/KokkosKernels/" "cmake/KokkosKernels/" - ) + find_package_local(KokkosKernels KokkosKernels) # Used to properly setup transitive dependency in checkpointConfig.cmake.in set(CHECKPOINT_HAS_KOKKOS_KERNELS_LIBRARY 1) else() diff --git a/cmake/load_package.cmake b/cmake/load_package.cmake index 693b6fb4..b4fee42c 100644 --- a/cmake/load_package.cmake +++ b/cmake/load_package.cmake @@ -21,7 +21,7 @@ macro(require_pkg_directory pkg_name pkg_user_name) endif() endmacro(require_pkg_directory) -macro(find_package_local pkg_name pkg_directory pkg_other_name) +macro(find_package_local pkg_name pkg_other_name) get_directory_property(hasParent PARENT_DIRECTORY) if(hasParent) # Skip this logic when this macro was not invoked from the @@ -32,63 +32,32 @@ macro(find_package_local pkg_name pkg_directory pkg_other_name) #message(STATUS "skipping find_package for ${pkg_name}") else() + if(DEFINED ${pkg_name}_DIR AND NOT DEFINED ${pkg_name}_ROOT) + set(${pkg_name}_ROOT ${${pkg_name}_DIR}) + endif() + message( - STATUS "find_package_local: pkg name=\"${pkg_name}\", " - "directory=\"${pkg_directory}\"" + STATUS "find_package_local: pkg name=\"${pkg_name}\", ${pkg_name}_ROOT=\"${${pkg_name}_ROOT}\"" ) - # Rest of the arguments are potential relative search paths wrt the - # ${pkg_directory} - set(prefix_args ${ARGN}) - - # Default search paths: root, /cmake and /CMake subdirectories - list(APPEND prefix_args "/" "/cmake" "/CMake") - # Whether we loaded the package in the following loop with find_package() set(${pkg_name}_PACKAGE_LOADED 0) - foreach(prefix ${prefix_args}) - set(potential_path ${pkg_directory}/${prefix}) - # message("prefix: ${potential_path}") - if (EXISTS "${potential_path}") - # message(STATUS "find_package_local: trying path: ${potential_path}") - - # Search locally only for package based on the user's supplied path; if - # this fails try to next one. Even if the directory exists (tested above) - # this might fail if a directory does not have the config file - find_package( - ${pkg_name} - PATHS ${potential_path} - NAMES ${pkg_name} ${pkg_other_name} - NO_CMAKE_PACKAGE_REGISTRY - NO_CMAKE_BUILDS_PATH - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_SYSTEM_PACKAGE_REGISTRY - NO_SYSTEM_ENVIRONMENT_PATH - QUIET - ) - - # Break out of the search loop now that we have found the path - if (${${pkg_name}_FOUND}) - message(STATUS "find_package_local: found with prefix: ${prefix}: ${${pkg_name}_DIR}") - set(${pkg_name}_PACKAGE_LOADED 1) - break() - endif() - endif() - endforeach() - - if (NOT ${${pkg_name}_PACKAGE_LOADED}) - message(STATUS "find_package_local: can not find package: ${pkg_name}") - - foreach(prefix ${prefix_args}) - set(path ${${pkg_name}_DIR}/${prefix}) - message(STATUS "find_package_local: searched: ${path}") - endforeach() + # Search locally only for package based on the user's supplied path; + find_package( + ${pkg_name} + NAMES ${pkg_name} ${pkg_other_name} + NO_CMAKE_PACKAGE_REGISTRY + NO_CMAKE_BUILDS_PATH + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_SYSTEM_PACKAGE_REGISTRY + NO_SYSTEM_ENVIRONMENT_PATH + QUIET + REQUIRED + ) - message( - FATAL_ERROR "find_package_local: can not find package: ${pkg_name}" - " tried to find_package(..) with above search paths" - ) + if(${pkg_name}_FOUND) + set(${pkg_name}_PACKAGE_LOADED 1) endif() endif() endmacro(find_package_local) From 581664599ff72c1a2ad58d728d2b0fbb6752bff6 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Mon, 24 Jun 2024 13:55:26 +0200 Subject: [PATCH 2/6] #354: Update packageName_ROOT variable to hold multiple prefixes --- cmake/load_package.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/load_package.cmake b/cmake/load_package.cmake index b4fee42c..ac791a38 100644 --- a/cmake/load_package.cmake +++ b/cmake/load_package.cmake @@ -33,7 +33,12 @@ macro(find_package_local pkg_name pkg_other_name) #message(STATUS "skipping find_package for ${pkg_name}") else() if(DEFINED ${pkg_name}_DIR AND NOT DEFINED ${pkg_name}_ROOT) - set(${pkg_name}_ROOT ${${pkg_name}_DIR}) + set(${pkg_name}_ROOT "${${pkg_name}_DIR}" + "${${pkg_name}_DIR}/cmake/${pkg_name}/" + "${${pkg_name}_DIR}/cmake/${pkg_other_name}/" + "${${pkg_name}_DIR}/CMake/${pkg_name}/" + "${${pkg_name}_DIR}/CMake/${pkg_other_name}/" + ) endif() message( From 3815adad0821382272aa3d9ac6fa676bae7960d0 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Mon, 24 Jun 2024 14:32:11 +0200 Subject: [PATCH 3/6] #354: Use 3.23 CMake for all CI pipelines --- ci/docker/ubuntu-18.04-clang-cpp.dockerfile | 2 -- ci/docker/ubuntu-18.04-gnu-cpp.dockerfile | 2 -- ci/docker/ubuntu-18.04-intel-cpp.dockerfile | 4 +++- ci/docker/ubuntu-20.04-gnu-docs.dockerfile | 2 +- ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ci/docker/ubuntu-18.04-clang-cpp.dockerfile b/ci/docker/ubuntu-18.04-clang-cpp.dockerfile index 51273c7e..90b7aceb 100644 --- a/ci/docker/ubuntu-18.04-clang-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-clang-cpp.dockerfile @@ -38,8 +38,6 @@ RUN ln -s \ ENV CC=${compiler} \ CXX=clang++ -ARG arch - COPY ./ci/deps/cmake.sh cmake.sh RUN ./cmake.sh 3.23.4 ${arch} diff --git a/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile b/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile index 7674923c..8770e219 100644 --- a/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile @@ -42,8 +42,6 @@ RUN ln -s \ ENV CC=gcc \ CXX=g++ -ARG arch - COPY ./ci/deps/cmake.sh cmake.sh RUN ./cmake.sh 3.23.4 ${arch} diff --git a/ci/docker/ubuntu-18.04-intel-cpp.dockerfile b/ci/docker/ubuntu-18.04-intel-cpp.dockerfile index 7c14fbd2..384c36b0 100644 --- a/ci/docker/ubuntu-18.04-intel-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-intel-cpp.dockerfile @@ -35,8 +35,10 @@ RUN ln -s \ /opt/intel/install/bin/icc \ /opt/intel/install/bin/gcc +ARG arch + COPY ./ci/deps/cmake.sh cmake.sh -RUN ./cmake.sh 3.18.4 +RUN ./cmake.sh 3.23.4 ${arch} ENV PATH=/cmake/bin/:$PATH COPY ./ci/deps/gtest.sh gtest.sh diff --git a/ci/docker/ubuntu-20.04-gnu-docs.dockerfile b/ci/docker/ubuntu-20.04-gnu-docs.dockerfile index fbcde17d..d81078cd 100644 --- a/ci/docker/ubuntu-20.04-gnu-docs.dockerfile +++ b/ci/docker/ubuntu-20.04-gnu-docs.dockerfile @@ -36,7 +36,7 @@ RUN apt-get update -y -q && \ rm -rf /var/lib/apt/lists/* COPY ./ci/deps/cmake.sh cmake.sh -RUN ./cmake.sh 3.18.4 +RUN ./cmake.sh 3.23.4 ${arch} ENV PATH=/cmake/bin/:$PATH ENV LESSCHARSET=utf-8 diff --git a/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile b/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile index e6775497..f87f66c2 100644 --- a/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile +++ b/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile @@ -34,7 +34,7 @@ ENV CC=gcc \ CXX=g++ COPY ./ci/deps/cmake.sh cmake.sh -RUN ./cmake.sh 3.18.4 +RUN ./cmake.sh 3.23.4 ${arch} COPY ./ci/deps/mpich.sh mpich.sh RUN ./mpich.sh 3.3.2 -j4 From 1581715f31f62aed0d71e66bd6eb893d1bf3bb10 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Mon, 24 Jun 2024 20:52:07 +0200 Subject: [PATCH 4/6] #354: Fix issue when optional package is being used with packageName_ROOT CMake variable --- cmake/load_package.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/load_package.cmake b/cmake/load_package.cmake index ac791a38..df14f9d5 100644 --- a/cmake/load_package.cmake +++ b/cmake/load_package.cmake @@ -82,12 +82,11 @@ macro(optional_pkg_directory pkg_name pkg_user_name assume_found_if_hasparent) endif() else() #message(STATUS "optional_pkg_directory: name=${pkg_name}") - option(${pkg_name}_DIR "Root folder for ${pkg_user_name} installation" OFF) - if (NOT ${pkg_name}_DIR) + if (NOT ${pkg_name}_DIR AND NOT ${pkg_name}_ROOT) message( STATUS "Path for ${pkg_user_name} library (optional) not specified " - "with -D${pkg_name}_DIR=" + "with -D${pkg_name}_DIR= or -D${pkg_name}_ROOT=" ) message( STATUS @@ -98,7 +97,7 @@ macro(optional_pkg_directory pkg_name pkg_user_name assume_found_if_hasparent) message( STATUS "Path for ${pkg_user_name} library (optional) specified " - "with -D${pkg_name}_DIR=${${pkg_name}_DIR}" + "with -D${pkg_name}_DIR=${${pkg_name}_DIR} -D${pkg_name}_ROOT=${${pkg_name}_ROOT}" ) set(${pkg_name}_DIR_FOUND 1) endif() From 25a453cf8150435d12082f8b72e3a19244ed8a4c Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Tue, 25 Jun 2024 14:19:54 +0200 Subject: [PATCH 5/6] #354: Remove no longer used variable in find_packge_local --- cmake/load_package.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cmake/load_package.cmake b/cmake/load_package.cmake index df14f9d5..11f24628 100644 --- a/cmake/load_package.cmake +++ b/cmake/load_package.cmake @@ -45,9 +45,6 @@ macro(find_package_local pkg_name pkg_other_name) STATUS "find_package_local: pkg name=\"${pkg_name}\", ${pkg_name}_ROOT=\"${${pkg_name}_ROOT}\"" ) - # Whether we loaded the package in the following loop with find_package() - set(${pkg_name}_PACKAGE_LOADED 0) - # Search locally only for package based on the user's supplied path; find_package( ${pkg_name} @@ -60,10 +57,6 @@ macro(find_package_local pkg_name pkg_other_name) QUIET REQUIRED ) - - if(${pkg_name}_FOUND) - set(${pkg_name}_PACKAGE_LOADED 1) - endif() endif() endmacro(find_package_local) From bc9a21b73deee0504966e612674c7fcb9ef65b68 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Wed, 26 Jun 2024 12:39:20 +0200 Subject: [PATCH 6/6] #354: Update the way we point to Kokkos' install directory --- CMakeLists.txt | 14 +++++++------- ci/build_cpp.sh | 4 ++-- ci/deps/kokkos-kernels.sh | 2 +- ci/docker/ubuntu-18.04-clang-cpp.dockerfile | 4 ++-- ci/docker/ubuntu-18.04-gnu-cpp.dockerfile | 4 ++-- ci/docker/ubuntu-18.04-intel-cpp.dockerfile | 4 ++-- ci/docker/ubuntu-20.04-gnu-docs.dockerfile | 4 ++-- ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile | 4 ++-- ci/docker/ubuntu-22.04-clang-cpp.dockerfile | 4 ++-- cmake/checkpointConfig.cmake.in | 5 +++-- cmake/load_package.cmake | 7 ++----- docs/md/checkpoint_learn_build.md | 2 +- src/CMakeLists.txt | 4 ++-- 13 files changed, 30 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc756454..69b16ce0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,12 +109,12 @@ option(kokkos_kernels_DISABLE "Disable Kokkos Kernels" OFF) if (NOT kokkos_DISABLE) # optional packages - optional_pkg_directory(kokkos "Kokkos" 1) + optional_pkg_directory(Kokkos "Kokkos" 1) - if (${kokkos_DIR_FOUND}) - find_package_local(kokkos Kokkos) - # Used to properly setup transitive dependency in checkpointConfig.cmake.in - set(CHECKPOINT_HAS_KOKKOS_LIBRARY 1) + if (${Kokkos_DIR_FOUND}) + find_package_local(Kokkos) + # Used to properly setup transitive dependency in checkpointConfig.cmake.in + set(CHECKPOINT_HAS_KOKKOS_LIBRARY 1) else() set(CHECKPOINT_HAS_KOKKOS_LIBRARY 0) endif() @@ -124,8 +124,8 @@ if (NOT kokkos_kernels_DISABLE) # optional packages optional_pkg_directory(KokkosKernels "Kokkos kernels" 1) - if (KokkosKernels_DIR_FOUND) - find_package_local(KokkosKernels KokkosKernels) + if (${KokkosKernels_DIR_FOUND}) + find_package_local(KokkosKernels) # Used to properly setup transitive dependency in checkpointConfig.cmake.in set(CHECKPOINT_HAS_KOKKOS_KERNELS_LIBRARY 1) else() diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 222d0b74..e97c2644 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -50,8 +50,8 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \ -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH:-}" \ -DCMAKE_INSTALL_PREFIX="$CHECKPOINT_BUILD/install" \ -DGTEST_ROOT="${GTEST_ROOT}" \ - -Dkokkos_DIR="${KOKKOS_ROOT}" \ - -DKokkosKernels_DIR="${KOKKOS_KERNELS_ROOT}" \ + -DKokkos_ROOT="${KOKKOS_ROOT}" \ + -DKokkosKernels_ROOT="${KOKKOS_KERNELS_ROOT}" \ "$CHECKPOINT" if test "${CHECKPOINT_DOXYGEN_ENABLED:-0}" -eq 1 diff --git a/ci/deps/kokkos-kernels.sh b/ci/deps/kokkos-kernels.sh index b789893c..cc5f0946 100755 --- a/ci/deps/kokkos-kernels.sh +++ b/ci/deps/kokkos-kernels.sh @@ -31,7 +31,7 @@ mkdir build cd build cmake -G "${CMAKE_GENERATOR:-Ninja}" \ - -DCMAKE_PREFIX_PATH="${KOKKOS_ROOT}/cmake" \ + -DCMAKE_PREFIX_PATH="${KOKKOS_ROOT}/lib/cmake" \ -DCMAKE_INSTALL_PREFIX="$kokkos_build/install" \ "$kokkos" cmake --build . --target install diff --git a/ci/docker/ubuntu-18.04-clang-cpp.dockerfile b/ci/docker/ubuntu-18.04-clang-cpp.dockerfile index 90b7aceb..51dcc564 100644 --- a/ci/docker/ubuntu-18.04-clang-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-clang-cpp.dockerfile @@ -53,11 +53,11 @@ ENV GTEST_ROOT=/pkgs/gtest/install COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 0 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install ENV MPI_EXTRA_FLAGS="" \ CMAKE_PREFIX_PATH="/lib/x86_64-linux-gnu/" \ diff --git a/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile b/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile index 8770e219..e9b469cf 100644 --- a/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-gnu-cpp.dockerfile @@ -57,11 +57,11 @@ ENV GTEST_ROOT=/pkgs/gtest/install COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 1 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install ENV MPI_EXTRA_FLAGS="" \ PATH=/usr/lib/ccache/:$PATH diff --git a/ci/docker/ubuntu-18.04-intel-cpp.dockerfile b/ci/docker/ubuntu-18.04-intel-cpp.dockerfile index 384c36b0..9b5a823f 100644 --- a/ci/docker/ubuntu-18.04-intel-cpp.dockerfile +++ b/ci/docker/ubuntu-18.04-intel-cpp.dockerfile @@ -55,11 +55,11 @@ ENV CC=/opt/intel/install/bin/icc \ COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 1 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install ENV MPI_EXTRA_FLAGS="" \ PATH=/usr/lib/ccache/:$PATH \ diff --git a/ci/docker/ubuntu-20.04-gnu-docs.dockerfile b/ci/docker/ubuntu-20.04-gnu-docs.dockerfile index d81078cd..8b143f4c 100644 --- a/ci/docker/ubuntu-20.04-gnu-docs.dockerfile +++ b/ci/docker/ubuntu-20.04-gnu-docs.dockerfile @@ -47,11 +47,11 @@ ENV GTEST_ROOT=/pkgs/gtest/install COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 1 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install ENV MPI_EXTRA_FLAGS="" \ CMAKE_PREFIX_PATH="/lib/x86_64-linux-gnu/" \ diff --git a/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile b/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile index f87f66c2..7acb5f4b 100644 --- a/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile +++ b/ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile @@ -48,7 +48,7 @@ ENV GTEST_ROOT=/pkgs/gtest/install COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 0 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install RUN mkdir -p /nvcc_wrapper/build && \ wget https://raw.githubusercontent.com/kokkos/kokkos/master/bin/nvcc_wrapper -P /nvcc_wrapper/build && \ @@ -60,7 +60,7 @@ ENV MPI_EXTRA_FLAGS="" \ COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install FROM base as build COPY . /checkpoint diff --git a/ci/docker/ubuntu-22.04-clang-cpp.dockerfile b/ci/docker/ubuntu-22.04-clang-cpp.dockerfile index f0e751bf..8a49b31f 100644 --- a/ci/docker/ubuntu-22.04-clang-cpp.dockerfile +++ b/ci/docker/ubuntu-22.04-clang-cpp.dockerfile @@ -55,11 +55,11 @@ ENV GTEST_ROOT=/pkgs/gtest/install COPY ./ci/deps/kokkos.sh kokkos.sh RUN ./kokkos.sh 4.1.00 /pkgs 0 -ENV KOKKOS_ROOT=/pkgs/kokkos/install/lib +ENV KOKKOS_ROOT=/pkgs/kokkos/install COPY ./ci/deps/kokkos-kernels.sh kokkos-kernels.sh RUN ./kokkos-kernels.sh 4.1.00 /pkgs -ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install/lib +ENV KOKKOS_KERNELS_ROOT=/pkgs/kokkos-kernels/install ENV MPI_EXTRA_FLAGS="" \ CMAKE_PREFIX_PATH="/lib/x86_64-linux-gnu/" \ diff --git a/cmake/checkpointConfig.cmake.in b/cmake/checkpointConfig.cmake.in index 6ff50af6..c8115130 100644 --- a/cmake/checkpointConfig.cmake.in +++ b/cmake/checkpointConfig.cmake.in @@ -6,6 +6,7 @@ include(${SELF_DIR}/checkpointTargets.cmake) include(CMakeFindDependencyMacro) if (@CHECKPOINT_HAS_KOKKOS_LIBRARY@) - set (kokkos_DIR @kokkos_DIR@) - find_dependency(kokkos REQUIRED HINTS @kokkos_DIR@ NAMES Kokkos) + set (Kokkos_DIR @Kokkos_DIR@) + set (Kokkos_ROOT @Kokkos_ROOT@) + find_dependency(kokkos REQUIRED HINTS @Kokkos_DIR@ @Kokkos_ROOT@ NAMES Kokkos) endif() diff --git a/cmake/load_package.cmake b/cmake/load_package.cmake index 11f24628..3dffa41b 100644 --- a/cmake/load_package.cmake +++ b/cmake/load_package.cmake @@ -21,7 +21,7 @@ macro(require_pkg_directory pkg_name pkg_user_name) endif() endmacro(require_pkg_directory) -macro(find_package_local pkg_name pkg_other_name) +macro(find_package_local pkg_name) get_directory_property(hasParent PARENT_DIRECTORY) if(hasParent) # Skip this logic when this macro was not invoked from the @@ -35,9 +35,7 @@ macro(find_package_local pkg_name pkg_other_name) if(DEFINED ${pkg_name}_DIR AND NOT DEFINED ${pkg_name}_ROOT) set(${pkg_name}_ROOT "${${pkg_name}_DIR}" "${${pkg_name}_DIR}/cmake/${pkg_name}/" - "${${pkg_name}_DIR}/cmake/${pkg_other_name}/" "${${pkg_name}_DIR}/CMake/${pkg_name}/" - "${${pkg_name}_DIR}/CMake/${pkg_other_name}/" ) endif() @@ -45,10 +43,9 @@ macro(find_package_local pkg_name pkg_other_name) STATUS "find_package_local: pkg name=\"${pkg_name}\", ${pkg_name}_ROOT=\"${${pkg_name}_ROOT}\"" ) - # Search locally only for package based on the user's supplied path; find_package( ${pkg_name} - NAMES ${pkg_name} ${pkg_other_name} + NAMES ${pkg_name} NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_BUILDS_PATH NO_CMAKE_SYSTEM_PATH diff --git a/docs/md/checkpoint_learn_build.md b/docs/md/checkpoint_learn_build.md index c443a7ac..18403acf 100644 --- a/docs/md/checkpoint_learn_build.md +++ b/docs/md/checkpoint_learn_build.md @@ -22,7 +22,7 @@ build configuration: | CMake Variable | Default Value | Description | | ---------------------------------------------------- | ------------- | --------------------------------------------- | | `gtest_DIR` | | Install directory for googletest | -| `kokkos_DIR` | | Install directory for kokkos | +| `Kokkos_DIR` | | Install directory for kokkos | | `KokkosKernels_DIR` | | Install directory for kokkoskernels | | `checkpoint_tests_enabled` | 0 | Build *checkpoint* tests | | `checkpoint_mpi_enabled` | 0 | Build *checkpoint* with MPI for tests | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3205d9a..a6052487 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,8 +77,8 @@ target_compile_features(${CHECKPOINT_LIBRARY} PUBLIC cxx_std_17) include(CMakePrintHelpers) -if (${kokkos_DIR_FOUND}) - if (KokkosKernels_DIR_FOUND) +if (${Kokkos_DIR_FOUND}) + if (${KokkosKernels_DIR_FOUND}) message(STATUS "Checkpoint: Kokkos kernels enabled") set(KERNELS 1) # Kokkos Kernels historically installed its EXPORT targets in the Kokkos:: namespace, and several