-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from CExA-project/cmake-install
Adding install capability
- Loading branch information
Showing
17 changed files
with
353 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@PACKAGE_INIT@ | ||
|
||
# Set and Check must go first else macro might be redefined by find_dependency ... | ||
set_and_check(KokkosFFT_TARGET_FILE | ||
"${PACKAGE_PREFIX_DIR}/@LIBDIR@/@[email protected]") | ||
|
||
include(CMakeFindDependencyMacro) | ||
list(INSERT CMAKE_MODULE_PATH 0 "${PACKAGE_PREFIX_DIR}/@LIBDIR@") | ||
find_dependency(Kokkos) | ||
|
||
if(@Kokkos_ENABLE_CUDA@) | ||
find_dependency(CUDAToolkit COMPONENTS cufft) | ||
if(@KokkosFFT_ENABLE_HOST_AND_DEVICE@) | ||
find_dependency(FFTW MODULE) | ||
endif() | ||
elseif(@Kokkos_ENABLE_HIP@) | ||
find_dependency(hipfft) | ||
if(@KokkosFFT_ENABLE_HOST_AND_DEVICE@) | ||
find_dependency(FFTW MODULE) | ||
endif() | ||
elseif(@Kokkos_ENABLE_OPENMP@) | ||
find_dependency(FFTW MODULE) | ||
elseif(@Kokkos_ENABLE_SERIAL@) | ||
find_dependency(FFTW MODULE) | ||
endif() | ||
|
||
include(${KokkosFFT_TARGET_FILE}) | ||
|
||
check_required_components(KokkosFFT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(01_1DFFT 01_1DFFT.cpp) | ||
target_link_libraries(01_1DFFT PUBLIC Kokkos::fft) | ||
target_link_libraries(01_1DFFT PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(02_2DFFT 02_2DFFT.cpp) | ||
target_link_libraries(02_2DFFT PUBLIC Kokkos::fft) | ||
target_link_libraries(02_2DFFT PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(03_NDFFT 03_NDFFT.cpp) | ||
target_link_libraries(03_NDFFT PUBLIC Kokkos::fft) | ||
target_link_libraries(03_NDFFT PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(04_batchedFFT 04_batchedFFT.cpp) | ||
target_link_libraries(04_batchedFFT PUBLIC Kokkos::fft) | ||
target_link_libraries(04_batchedFFT PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(05_1DFFT_HOST_DEVICE 05_1DFFT_HOST_DEVICE.cpp) | ||
target_link_libraries(05_1DFFT_HOST_DEVICE PUBLIC Kokkos::fft) | ||
target_link_libraries(05_1DFFT_HOST_DEVICE PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_executable(06_1DFFT_reuse_plans 06_1DFFT_reuse_plans.cpp) | ||
target_link_libraries(06_1DFFT_reuse_plans PUBLIC Kokkos::fft) | ||
target_link_libraries(06_1DFFT_reuse_plans PUBLIC KokkosFFT::fft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
args=$# | ||
ROOT_DIR=$1 | ||
WK_DIR=$(pwd) | ||
TARGET="cpu" | ||
|
||
# Install Kokkos | ||
export KOKKOS_INSTALL_PREFIX=${ROOT_DIR}/usr/local/kokkos_${TARGET} | ||
export Kokkos_DIR=${KOKKOS_INSTALL_PREFIX}/lib/cmake/Kokkos | ||
export KOKKOS_BUILD_DIR=build_Kokkos_${TARGET} | ||
|
||
export KOKKOSFFT_INSTALL_PREFIX=${ROOT_DIR}/usr/local/kokkosFFT_${TARGET} | ||
export KokkosFFT_DIR=${KOKKOSFFT_INSTALL_PREFIX}/lib/cmake/kokkos-fft | ||
export KOKKOSFFT_BUILD_DIR=build_KokkosFFT_${TARGET} | ||
|
||
export EXAMPLE_BUILD_DIR=build_example_${TARGET} | ||
|
||
# Install Kokkos | ||
cd ${WK_DIR} | ||
mkdir ${KOKKOS_BUILD_DIR} && cd ${KOKKOS_BUILD_DIR} | ||
|
||
# Get Kokkos from github repo and build | ||
git clone https://github.com/kokkos/kokkos.git | ||
cmake -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKokkos_ENABLE_OPENMP=ON -DCMAKE_INSTALL_PREFIX=${KOKKOS_INSTALL_PREFIX} kokkos | ||
cmake --build . -j 8 | ||
cmake --install . | ||
|
||
# Install KokkosFFT | ||
cd ${WK_DIR} | ||
mkdir ${KOKKOSFFT_BUILD_DIR} && cd ${KOKKOSFFT_BUILD_DIR} | ||
cmake -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DKokkos_ENABLE_OPENMP=ON -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. | ||
cmake --build . -j 8 | ||
cmake --install . | ||
|
||
# Try to build an example | ||
# Build KokkosFFT code using installed KokkosFFT | ||
cd ${WK_DIR} | ||
mkdir ${EXAMPLE_BUILD_DIR} && cd ${EXAMPLE_BUILD_DIR} | ||
cmake -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON ../install_test/src | ||
cmake --build . -j 8 | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "*** install test: build SUCCESSFUL ***" | ||
else | ||
echo "*** install test: build FAILED ***" | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
args=$# | ||
ROOT_DIR=$1 | ||
WK_DIR=$(pwd) | ||
TARGET=$2 | ||
KOKKOS_TARGET=${TARGET} | ||
|
||
# Install Kokkos | ||
export KOKKOS_INSTALL_PREFIX=${ROOT_DIR}/usr/local/kokkos_${KOKKOS_TARGET} | ||
export Kokkos_DIR=${KOKKOS_INSTALL_PREFIX}/lib/cmake/Kokkos | ||
export KOKKOS_BUILD_DIR=build_Kokkos_${KOKKOS_TARGET} | ||
|
||
export KOKKOSFFT_INSTALL_PREFIX=${ROOT_DIR}/usr/local/kokkosFFT_${TARGET} | ||
export KokkosFFT_DIR=${KOKKOSFFT_INSTALL_PREFIX}/lib/cmake/kokkos-fft | ||
export KOKKOSFFT_BUILD_DIR=build_KokkosFFT_${TARGET} | ||
|
||
export EXAMPLE_BUILD_DIR=build_example_${TARGET} | ||
export CXX_COMPILER=${WK_DIR}/${KOKKOS_BUILD_DIR}/kokkos/bin/nvcc_wrapper | ||
|
||
# Install Kokkos if not exist | ||
if [ ! -d ${Kokkos_DIR} ]; then | ||
cd ${WK_DIR} | ||
mkdir ${KOKKOS_BUILD_DIR} && cd ${KOKKOS_BUILD_DIR} | ||
|
||
# Get Kokkos from github repo and build | ||
git clone https://github.com/kokkos/kokkos.git | ||
cmake -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ | ||
-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON \ | ||
-DCMAKE_INSTALL_PREFIX=${KOKKOS_INSTALL_PREFIX} kokkos | ||
|
||
cmake --build . -j 8 | ||
cmake --install . | ||
fi | ||
|
||
# Install KokkosFFT | ||
cd ${WK_DIR} | ||
mkdir ${KOKKOSFFT_BUILD_DIR} && cd ${KOKKOSFFT_BUILD_DIR} | ||
if [ $TARGET == "CUDA" ]; then | ||
cmake -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ | ||
-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON \ | ||
-DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. | ||
else | ||
cmake -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ | ||
-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON \ | ||
-DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} -DKokkosFFT_ENABLE_HOST_AND_DEVICE=ON .. | ||
fi | ||
cmake --build . -j 8 | ||
cmake --install . | ||
|
||
# Try to build an example | ||
# Build KokkosFFT code using installed KokkosFFT | ||
cd ${WK_DIR} | ||
mkdir ${EXAMPLE_BUILD_DIR} && cd ${EXAMPLE_BUILD_DIR} | ||
cmake -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \ | ||
-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON ../install_test/src | ||
cmake --build . -j 8 | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "*** install test: build SUCCESSFUL ***" | ||
else | ||
echo "*** install test: build FAILED ***" | ||
exit 1; | ||
fi |
Oops, something went wrong.