Skip to content

Commit

Permalink
#354: Update the way we point to Kokkos' install directory
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Jun 26, 2024
1 parent 25a453c commit 61e15e7
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 31 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-18.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/" \
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-18.04-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-18.04-intel-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-20.04-gnu-docs.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/" \
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-20.04-nvidia-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/docker/ubuntu-22.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/" \
Expand Down
5 changes: 3 additions & 2 deletions cmake/checkpointConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 2 additions & 5 deletions cmake/load_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,20 +35,17 @@ 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()

message(
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
Expand Down
2 changes: 1 addition & 1 deletion docs/md/checkpoint_learn_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61e15e7

Please sign in to comment.