From 9bb66d8a22898132059ba9f637c23d5d4e3cbaf2 Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:44:18 +0100 Subject: [PATCH 01/10] Update README.md More explanations --- README.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9600ad14..a92f779b 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ UNOFFICIAL FFT interfaces for Kokkos C++ Performance Portability Programming Eco KokkosFFT implements local interfaces Kokkos and de facto standard FFT libraries, including fftw, cufft and hipfft. "Local" means not using MPI, or running within a -single MPI process without knowing about MPI. We are inclined to implement the numpy FFT interfaces based on Kokkos. -Here is the example for 1D case in python and KokkosFFT. +single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) interfaces based on [Kokkos](https://github.com/kokkos/kokkos). +A key concept is that "As easy as numpy, as fast as vendor libraries". Accordingly, our APIs follow the APIs by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. If something is wrong with runtime values, it will raise runtime errors. Here is the example for 1D real to complex transform with ```rfft``` in python and KokkosFFT. ```python3 import numpy as np x = np.random.rand(4) @@ -33,6 +33,8 @@ Kokkos::fence(); KokkosFFT::rfft(execution_space(), x, x_hat); ``` +There are two major differences: ```execution_space``` argument and updating output as argument not returned. As imagined, KokkosFFT only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from ```execution_space``` is statically checked (compilation errors if not accessible). + Depending on the View dimension, it automatically uses the batched plans as follows ```python3 import numpy as np @@ -60,7 +62,92 @@ int axis = -1; KokkosFFT::rfft(execution_space(), x, x_hat, KokkosFFT::FFT_Normalization::BACKWARD, axis); // FFT along -1 axis and batched along 0th axis ``` -## Building KokkosFFT +In this example, the 1D batched ```rfft``` over 2D View along ```axis -1``` is executed. Some basic examples are found in [examples](https://github.com/CExA-project/kokkos-fft/tree/main/examples). + +## Using KokkosFFT +For the moment, there are two ways to use KokkosFFT: including as a subdirectory in CMake project or installing as a library. First of all, you need to clone this repo. +```bash +git clone --recursive https://github.com/CExA-project/kokkos-fft.git +``` ### CMake -Up to now, we just rely on the CMake options for Kokkos. +Since KokkosFFT is a header-only library, it is enough to simply add as a subdirectory. It is assumed that kokkos and kokkosFFT are placed under ```/tpls```. +Here is an example to use KokkosFFT in the following CMake project. +``` +---/ + | + └──/ + |--tpls + | |--kokkos/ + | └──kokkosFFT/ + |--CMakeLists.txt + └──hello.cpp +``` + +The ```CMakeLists.txt``` would be +```CMake +cmake_minimum_required(VERSION 3.23) +project(kokkos-fft LANGUAGES CXX) + +add_subdirectory(tpls/kokkos) +add_subdirectory(tpls/kokkos-fft) + +add_executable(hello-kokkos-fft hello.cpp) +target_link_libraries(hello-kokkos-fft PUBLIC Kokkos::kokkos KokkosFFT::fft) +``` + +For the compilation, we basically rely on the CMake options for Kokkos. For example, the configure options for A100 GPU is as follows. +``` +cmake -DBUILD_TESTING=ON \ + -DCMAKE_CXX_COMPILER=/tpls/kokkos/bin/nvcc_wrapper \ + -DCMAKE_BUILD_TYPE=Release \ + -DKokkos_ENABLE_CUDA=ON \ + -DKokkos_ENABLE_CUDA_CONSTEXPR=ON \ + -DKokkos_ARCH_AMPERE80=ON \ + -DKokkos_ENABLE_CUDA_LAMBDA=On .. +``` +This way, all the functionalities are executed on A100 GPUs. + +### Install as a library +Is is assumed that the Kokkos is installed under ```/kokkos``` targeting Skylake with OpenMP backend. ```Kokkos_dir``` also needs to be set appropriately. Here is a recipe to install KokkosFFT under ```/kokkosFFT```. + +```bash +export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT +export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft + +mkdir build_KokkosFFT && cd build_KokkosFFT +cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_COMPILER=icpx -DKokkos_ENABLE_OPENMP=ON -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. +cmake --build . -j 8 +cmake --install . +``` + +Here is an example to use KokkosFFT in the following CMake project. +``` +---/ + | + └──/ + |--CMakeLists.txt + └──hello.cpp +``` + +The ```CMakeLists.txt``` would be +```CMake +cmake_minimum_required(VERSION 3.23) +project(kokkos-fft LANGUAGES CXX) + +find_package(Kokkos CONFIG REQUIRED) +find_package(KokkosFFT CONFIG REQUIRED) + +add_executable(hello-kokkos-fft hello.cpp) +target_link_libraries(hello-kokkos-fft PUBLIC Kokkos::kokkos KokkosFFT::fft) +``` + +The code can be built as +```bash +export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT +export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft + +mkdir build && cd build +cmake -DCMAKE_CXX_COMPILER=icpx -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON .. +cmake --build . -j 8 +``` From 227b19f60577167708d55e63c0c53b2ea582802d Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:49:09 +0100 Subject: [PATCH 02/10] Adding Disclaimer --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a92f779b..90256a03 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,9 @@ KokkosFFT::rfft(execution_space(), x, x_hat, KokkosFFT::FFT_Normalization::BACKW In this example, the 1D batched ```rfft``` over 2D View along ```axis -1``` is executed. Some basic examples are found in [examples](https://github.com/CExA-project/kokkos-fft/tree/main/examples). +## Disclaimer +KokkosFFT is under development and subject to change without warning. The authors do not guarantee that this code runs correctly in all the environments. + ## Using KokkosFFT For the moment, there are two ways to use KokkosFFT: including as a subdirectory in CMake project or installing as a library. First of all, you need to clone this repo. ```bash From 09e4a34724728e24bb02c63c2cbb4247f6e42278 Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:19:55 +0100 Subject: [PATCH 03/10] Update README.md based on Review --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 90256a03..f984eaf3 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ UNOFFICIAL FFT interfaces for Kokkos C++ Performance Portability Programming EcoSystem -KokkosFFT implements local interfaces Kokkos and de facto standard FFT libraries, including fftw, cufft and hipfft. +KokkosFFT implements local interfaces Kokkos and de facto standard FFT libraries, including [fftw](http://www.fftw.org), [cufft](https://developer.nvidia.com/cufft) and [hipfft](https://github.com/ROCm/hipFFT). "Local" means not using MPI, or running within a -single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) interfaces based on [Kokkos](https://github.com/kokkos/kokkos). -A key concept is that "As easy as numpy, as fast as vendor libraries". Accordingly, our APIs follow the APIs by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. If something is wrong with runtime values, it will raise runtime errors. Here is the example for 1D real to complex transform with ```rfft``` in python and KokkosFFT. +single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html)-like interfaces adapted for [Kokkos](https://github.com/kokkos/kokkos). +A key concept is that "As easy as numpy, as fast as vendor libraries". Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. If something is wrong with runtime values (say ```View``` extents), it will raise runtime errors (C++ exceptions or assertions). Here is the example for 1D real to complex transform with ```rfft``` in python and KokkosFFT. ```python3 import numpy as np x = np.random.rand(4) @@ -33,7 +33,7 @@ Kokkos::fence(); KokkosFFT::rfft(execution_space(), x, x_hat); ``` -There are two major differences: ```execution_space``` argument and updating output as argument not returned. As imagined, KokkosFFT only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from ```execution_space``` is statically checked (compilation errors if not accessible). +There are two major differences: [```execution_space```](https://kokkos.org/kokkos-core-wiki/API/core/execution_spaces.html) argument and output value (```x_hat```) is an argument of API (not returned from API). As imagined, KokkosFFT only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from ```execution_space``` is statically checked (compilation errors if not accessible). Depending on the View dimension, it automatically uses the batched plans as follows ```python3 @@ -112,14 +112,14 @@ cmake -DBUILD_TESTING=ON \ This way, all the functionalities are executed on A100 GPUs. ### Install as a library -Is is assumed that the Kokkos is installed under ```/kokkos``` targeting Skylake with OpenMP backend. ```Kokkos_dir``` also needs to be set appropriately. Here is a recipe to install KokkosFFT under ```/kokkosFFT```. +Is is assumed that the Kokkos is installed under ```/kokkos``` targeting Icelake with OpenMP backend. ```Kokkos_dir``` also needs to be set appropriately. Here is a recipe to install KokkosFFT under ```/kokkosFFT```. ```bash export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft mkdir build_KokkosFFT && cd build_KokkosFFT -cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_COMPILER=icpx -DKokkos_ENABLE_OPENMP=ON -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. +cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_COMPILER=icpx -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. cmake --build . -j 8 cmake --install . ``` @@ -154,3 +154,7 @@ mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=icpx -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON .. cmake --build . -j 8 ``` + +## LICENCE +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +KokkosFFT is licensed under the MIT License. From 17e8a809816bfe186434f13bce6f15a2e68116ed Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:06:12 +0100 Subject: [PATCH 04/10] CMake configure commands are displayed in multiple lines --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f984eaf3..3999a40b 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,11 @@ export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft mkdir build_KokkosFFT && cd build_KokkosFFT -cmake -DBUILD_TESTING=OFF -DCMAKE_CXX_COMPILER=icpx -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. +cmake -DBUILD_TESTING=OFF \ + -DCMAKE_CXX_COMPILER=icpx \ + -DKokkos_ENABLE_OPENMP=ON \ + -DKokkos_ARCH_SKX=ON \ + -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. cmake --build . -j 8 cmake --install . ``` @@ -151,7 +155,9 @@ export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft mkdir build && cd build -cmake -DCMAKE_CXX_COMPILER=icpx -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON .. +cmake -DCMAKE_CXX_COMPILER=icpx \ + -DCMAKE_BUILD_TYPE=Release \ + -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON .. cmake --build . -j 8 ``` From 388814ccfbecdecb51c0b3b6b88cc0ccba01fedd Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:53:21 +0100 Subject: [PATCH 05/10] [README] minor fix --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3999a40b..67c4084f 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,8 @@ export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=icpx \ -DCMAKE_BUILD_TYPE=Release \ - -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_SKX=ON .. + -DKokkos_ENABLE_OPENMP=ON \ + -DKokkos_ARCH_SKX=ON .. cmake --build . -j 8 ``` From 3f9c042f81a36496866f218026619cf00f32b6f4 Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Thu, 25 Jan 2024 22:12:56 +0900 Subject: [PATCH 06/10] Update README.md based on the reviews --- README.md | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 67c4084f..9bb14cfa 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,8 @@ UNOFFICIAL FFT interfaces for Kokkos C++ Performance Portability Programming EcoSystem -KokkosFFT implements local interfaces Kokkos and de facto standard FFT libraries, including [fftw](http://www.fftw.org), [cufft](https://developer.nvidia.com/cufft) and [hipfft](https://github.com/ROCm/hipFFT). -"Local" means not using MPI, or running within a -single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html)-like interfaces adapted for [Kokkos](https://github.com/kokkos/kokkos). -A key concept is that "As easy as numpy, as fast as vendor libraries". Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. If something is wrong with runtime values (say ```View``` extents), it will raise runtime errors (C++ exceptions or assertions). Here is the example for 1D real to complex transform with ```rfft``` in python and KokkosFFT. +KokkosFFT implements local interfaces Kokkos and de facto standard FFT libraries, including [fftw](http://www.fftw.org), [cufft](https://developer.nvidia.com/cufft) and [hipfft](https://github.com/ROCm/hipFFT). "Local" means not using MPI, or running within a single MPI process without knowing about MPI. We are inclined to implement the [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html)-like interfaces adapted for [Kokkos](https://github.com/kokkos/kokkos). +A key concept is that "As easy as numpy, as fast as vendor libraries". Accordingly, our API follows the API by [numpy.fft](https://numpy.org/doc/stable/reference/routines.fft.html) with minor differences. A fft library dedicated to Kokkos Device backend (e.g. [cufft](https://developer.nvidia.com/cufft) for CUDA backend) is automatically used. If something is wrong with runtime values (say `View` extents), it will raise runtime errors (C++ exceptions or assertions). Here is an example for 1D real to complex transform with `rfft` in python and KokkosFFT. ```python3 import numpy as np x = np.random.rand(4) @@ -33,9 +31,9 @@ Kokkos::fence(); KokkosFFT::rfft(execution_space(), x, x_hat); ``` -There are two major differences: [```execution_space```](https://kokkos.org/kokkos-core-wiki/API/core/execution_spaces.html) argument and output value (```x_hat```) is an argument of API (not returned from API). As imagined, KokkosFFT only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from ```execution_space``` is statically checked (compilation errors if not accessible). +There are two major differences: [`execution_space`](https://kokkos.org/kokkos-core-wiki/API/core/execution_spaces.html) argument and output value (`x_hat`) is an argument of API (not returned value from API). As imagined, KokkosFFT only accepts [Kokkos Views](https://kokkos.org/kokkos-core-wiki/API/core/View.html) as input data. The accessibilities of Views from `execution_space` are statically checked (compilation errors if not accessible). -Depending on the View dimension, it automatically uses the batched plans as follows +Depending on a View dimension, it automatically uses the batched plans as follows ```python3 import numpy as np x = np.random.rand(4, 8) @@ -62,10 +60,10 @@ int axis = -1; KokkosFFT::rfft(execution_space(), x, x_hat, KokkosFFT::FFT_Normalization::BACKWARD, axis); // FFT along -1 axis and batched along 0th axis ``` -In this example, the 1D batched ```rfft``` over 2D View along ```axis -1``` is executed. Some basic examples are found in [examples](https://github.com/CExA-project/kokkos-fft/tree/main/examples). +In this example, the 1D batched `rfft` over 2D View along `axis -1` is executed. Some basic examples are found in [examples](https://github.com/CExA-project/kokkos-fft/tree/main/examples). ## Disclaimer -KokkosFFT is under development and subject to change without warning. The authors do not guarantee that this code runs correctly in all the environments. +**KokkosFFT is under development and subject to change without warning. The authors do not guarantee that this code runs correctly in all the environments.** ## Using KokkosFFT For the moment, there are two ways to use KokkosFFT: including as a subdirectory in CMake project or installing as a library. First of all, you need to clone this repo. @@ -74,8 +72,9 @@ git clone --recursive https://github.com/CExA-project/kokkos-fft.git ``` ### CMake -Since KokkosFFT is a header-only library, it is enough to simply add as a subdirectory. It is assumed that kokkos and kokkosFFT are placed under ```/tpls```. -Here is an example to use KokkosFFT in the following CMake project. +Since KokkosFFT is a header-only library, it is enough to simply add as a subdirectory. It is assumed that kokkos and kokkosFFT are placed under `/tpls`. + +Here is an example to use KokkosFFT in the following CMake project. ``` ---/ | @@ -87,10 +86,10 @@ Here is an example to use KokkosFFT in the following CMake project. └──hello.cpp ``` -The ```CMakeLists.txt``` would be +The `CMakeLists.txt` would be ```CMake cmake_minimum_required(VERSION 3.23) -project(kokkos-fft LANGUAGES CXX) +project(kokkos-fft-as-subdirectory LANGUAGES CXX) add_subdirectory(tpls/kokkos) add_subdirectory(tpls/kokkos-fft) @@ -99,7 +98,7 @@ add_executable(hello-kokkos-fft hello.cpp) target_link_libraries(hello-kokkos-fft PUBLIC Kokkos::kokkos KokkosFFT::fft) ``` -For the compilation, we basically rely on the CMake options for Kokkos. For example, the configure options for A100 GPU is as follows. +For compilation, we basically rely on the CMake options for Kokkos. For example, the configure options for A100 GPU is as follows. ``` cmake -DBUILD_TESTING=ON \ -DCMAKE_CXX_COMPILER=/tpls/kokkos/bin/nvcc_wrapper \ @@ -112,7 +111,7 @@ cmake -DBUILD_TESTING=ON \ This way, all the functionalities are executed on A100 GPUs. ### Install as a library -Is is assumed that the Kokkos is installed under ```/kokkos``` targeting Icelake with OpenMP backend. ```Kokkos_dir``` also needs to be set appropriately. Here is a recipe to install KokkosFFT under ```/kokkosFFT```. +Is is assumed that the Kokkos is installed under `/kokkos` with OpenMP backend. Here is a recipe to install KokkosFFT under `/kokkos_fft`. ```bash export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT @@ -121,14 +120,12 @@ export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft mkdir build_KokkosFFT && cd build_KokkosFFT cmake -DBUILD_TESTING=OFF \ -DCMAKE_CXX_COMPILER=icpx \ - -DKokkos_ENABLE_OPENMP=ON \ - -DKokkos_ARCH_SKX=ON \ -DCMAKE_INSTALL_PREFIX=${KOKKOSFFT_INSTALL_PREFIX} .. cmake --build . -j 8 cmake --install . ``` -Here is an example to use KokkosFFT in the following CMake project. +Here is an example to use KokkosFFT in the following CMake project. ``` ---/ | @@ -137,10 +134,10 @@ Here is an example to use KokkosFFT in the following CMake project. └──hello.cpp ``` -The ```CMakeLists.txt``` would be +The `CMakeLists.txt` would be ```CMake cmake_minimum_required(VERSION 3.23) -project(kokkos-fft LANGUAGES CXX) +project(kokkos-fft-as-library LANGUAGES CXX) find_package(Kokkos CONFIG REQUIRED) find_package(KokkosFFT CONFIG REQUIRED) @@ -151,17 +148,11 @@ target_link_libraries(hello-kokkos-fft PUBLIC Kokkos::kokkos KokkosFFT::fft) The code can be built as ```bash -export KOKKOSFFT_INSTALL_PREFIX=/kokkosFFT -export KokkosFFT_DIR=/kokkosFFT/lib64/cmake/kokkos-fft - mkdir build && cd build -cmake -DCMAKE_CXX_COMPILER=icpx \ - -DCMAKE_BUILD_TYPE=Release \ - -DKokkos_ENABLE_OPENMP=ON \ - -DKokkos_ARCH_SKX=ON .. +cmake -DCMAKE_PREFIX_PATH="/kokkos;/kokkos_fft" .. cmake --build . -j 8 ``` ## LICENCE [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -KokkosFFT is licensed under the MIT License. +KokkosFFT is licensed under the MIT License. \ No newline at end of file From 6b3b058f75ba727180a4b94f10eb5f06a8a05ec3 Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Thu, 25 Jan 2024 23:20:43 +0900 Subject: [PATCH 07/10] Modify CMake in order to rely on Kokkos added as a subdirectory --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abe4edca..f7782dc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.23) project(kokkos-fft LANGUAGES CXX) # Add cmake helpers for FFTW -list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake") +list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Options option(BUILD_EXAMPLES "Build kokkos-fft examples" ON) @@ -10,7 +10,12 @@ option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable fft on both host and device" OFF option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on external one" OFF) if (NOT KokkosFFT_INTERNAL_Kokkos) - find_package(Kokkos REQUIRED) + # First check, Kokkos is added as subdirectory or not + if (KOKKOS_PATH STREQUAL "") + find_package(Kokkos REQUIRED) + else() + message(STATUS "Using Kokkos at ${KOKKOS_PATH}") + endif() else () add_subdirectory(tpls/kokkos) endif () From 4f8bad45a16688cc21f58ebdfb8f3f7805ac267e Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:31:04 +0100 Subject: [PATCH 08/10] minor fix README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9bb14cfa..b8580eb7 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Here is an example to use KokkosFFT in the following CMake project. └──/ |--tpls | |--kokkos/ - | └──kokkosFFT/ + | └──kokkos-fft/ |--CMakeLists.txt └──hello.cpp ``` @@ -155,4 +155,4 @@ cmake --build . -j 8 ## LICENCE [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -KokkosFFT is licensed under the MIT License. \ No newline at end of file +KokkosFFT is licensed under the MIT License. From 071e567f5c5a37ec31a5817fedae86c58e885986 Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Fri, 26 Jan 2024 00:23:32 +0900 Subject: [PATCH 09/10] comparison in string --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7782dc0..deb75fa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on ex if (NOT KokkosFFT_INTERNAL_Kokkos) # First check, Kokkos is added as subdirectory or not - if (KOKKOS_PATH STREQUAL "") + if ("${KOKKOS_PATH}" STREQUAL "") find_package(Kokkos REQUIRED) else() message(STATUS "Using Kokkos at ${KOKKOS_PATH}") From f3840ffb1a2f4fa80d3099e67c5c4c65f269ba43 Mon Sep 17 00:00:00 2001 From: Yuuichi Asahi Date: Fri, 26 Jan 2024 00:40:49 +0900 Subject: [PATCH 10/10] Test if Kokkos is already included --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index deb75fa9..f5b02b65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,8 @@ option(KokkosFFT_INTERNAL_Kokkos "Build internal Kokkos instead of relying on ex if (NOT KokkosFFT_INTERNAL_Kokkos) # First check, Kokkos is added as subdirectory or not - if ("${KOKKOS_PATH}" STREQUAL "") + if(NOT TARGET Kokkos::kokkos) find_package(Kokkos REQUIRED) - else() - message(STATUS "Using Kokkos at ${KOKKOS_PATH}") endif() else () add_subdirectory(tpls/kokkos)