Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install test #64

Merged
merged 37 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a592ee3
recover scripts for build tests as lib
Feb 20, 2024
4480922
rename scripts
Feb 20, 2024
3d0e7cf
Add install tests in CI
Feb 20, 2024
5399547
fix path
Feb 20, 2024
fb4cf79
fix typo in CMake
Feb 20, 2024
42899d7
fix permission
Feb 20, 2024
4183a6c
fix path
Feb 20, 2024
3d6b5e8
fix path
Feb 20, 2024
4196455
fix path
Feb 20, 2024
e605b72
fix path
Feb 20, 2024
b8fddfd
fix path
Feb 20, 2024
85beb88
fix CMake option
Feb 20, 2024
fee1f7a
rename work
Feb 20, 2024
ef6dba3
Fix kokkos version check
Feb 20, 2024
902216a
fix script
Feb 20, 2024
f1478c2
fix issues for GPU build
Feb 20, 2024
695bed8
Add compilers
Feb 21, 2024
add1553
Simplify version check
Feb 22, 2024
39bfd9b
Do not clone Kokkos from repo in install test
Feb 22, 2024
902a6a0
update workflow
Feb 22, 2024
f1ac396
copy kokkos
Feb 22, 2024
5e0cff6
git clone kokkos again
Feb 22, 2024
bd7cc39
Merge branch 'main' into install-test
Feb 27, 2024
1a5182e
update CI to handle rocfft
Feb 27, 2024
31bf604
fix kokkos path
Feb 27, 2024
c9d6240
Use separate variable for KokkosFFT configure options
pzehner Feb 28, 2024
80ade25
Use objects instead of plain variables
pzehner Feb 28, 2024
e1eb8bd
Separate build and install jobs
pzehner Feb 28, 2024
d46a952
Fix prepare as subdirectory
pzehner Feb 28, 2024
5706110
Install early
pzehner Feb 28, 2024
53bed57
Fix prepare as subdirectory
pzehner Feb 28, 2024
f8672d8
Fix install paths
pzehner Feb 28, 2024
829e7c6
Mutualize build backends
pzehner Feb 28, 2024
7506ef6
Run install job after build job
pzehner Feb 28, 2024
a90454f
Merge build and install jobs
pzehner Feb 28, 2024
de719d7
Lower CMake requirements on install tests and harmonize file names
pzehner Feb 28, 2024
3a01923
Remove test install script
pzehner Feb 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 121 additions & 37 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
DOCKER_BUILDKIT: 1

jobs:
# run linter on the code
lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -28,12 +29,14 @@ jobs:
extensions: 'hpp,cpp'
clangFormatVersion: 12

# check if Docker images should be recreated
check_docker_files:
uses: ./.github/workflows/__check_docker_files.yaml

with:
event_name: ${{ github.event_name }}

# build Docker images if necessary
build_base:
needs: check_docker_files

Expand All @@ -45,6 +48,7 @@ jobs:
image_suffix: ${{ needs.check_docker_files.outputs.image_suffix }}
image_tag: ${{ needs.check_docker_files.outputs.image_tag }}

# build project
build:
runs-on: ubuntu-latest

Expand All @@ -60,41 +64,62 @@ jobs:
backend:
- name: openmp
image: gcc
c_compiler: gcc
cxx_compiler: g++
cmake_flags: -DKokkos_ENABLE_OPENMP=ON
compiler:
c: gcc
cxx: g++
cmake_flags:
kokkos: -DKokkos_ENABLE_OPENMP=ON
kokkos_fft: ""
- name: threads
image: gcc
c_compiler: gcc
cxx_compiler: g++
cmake_flags: -DKokkos_ENABLE_THREADS=ON
compiler:
c: gcc
cxx: g++
cmake_flags:
kokkos: -DKokkos_ENABLE_THREADS=ON
kokkos_fft: ""
- name: serial
image: gcc
c_compiler: gcc
cxx_compiler: g++
cmake_flags: -DKokkos_ENABLE_SERIAL=ON
compiler:
c: gcc
cxx: g++
cmake_flags:
kokkos: -DKokkos_ENABLE_SERIAL=ON
kokkos_fft: ""
- name: cuda
image: nvcc
c_compiler: gcc
cxx_compiler: g++
cmake_flags: -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON
compiler:
c: gcc
cxx: g++
cmake_flags:
kokkos: -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON
kokkos_fft: ""
- name: hip
image: rocm
c_compiler: hipcc
cxx_compiler: hipcc
cmake_flags: -DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON
compiler:
c: hipcc
cxx: hipcc
cmake_flags:
kokkos: -DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON
kokkos_fft: -DKokkosFFT_ENABLE_ROCFFT=ON
- name: rocm
image: rocm
c_compiler: hipcc
cxx_compiler: hipcc
cmake_flags: -DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON -DKokkosFFT_ENABLE_ROCFFT=ON
compiler:
c: hipcc
cxx: hipcc
cmake_flags:
kokkos: -DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON
kokkos_fft: ""
- name: sycl
image: intel
c_compiler: icx
cxx_compiler: icpx
# building for Intel PVC was unsuccessful without the proper device
# for now on, we simply use Intel GPU generic code
cmake_flags: -DKokkos_ENABLE_SYCL=ON -DKokkos_ARCH_INTEL_GEN=ON
compiler:
c: icx
cxx: icpx
cmake_flags:
# building for Intel PVC was unsuccessful without the proper
# device, so for now, we simply generate generic Intel GPU code
kokkos: -DKokkos_ENABLE_SYCL=ON -DKokkos_ARCH_INTEL_GEN=ON
kokkos_fft: ""
target:
- name: native
cmake_flags: ""
Expand Down Expand Up @@ -130,16 +155,16 @@ jobs:
run: |
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/work/install \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_C_COMPILER=${{ matrix.backend.c_compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.cxx_compiler }} \
-DCMAKE_C_COMPILER=${{ matrix.backend.compiler.c }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.compiler.cxx }} \
-DCMAKE_CXX_STANDARD=17 \
-DKokkosFFT_ENABLE_EXAMPLES=ON \
-DKokkosFFT_ENABLE_TESTS=ON \
-DKokkosFFT_ENABLE_BENCHMARK=ON \
-DKokkosFFT_ENABLE_INTERNAL_KOKKOS=ON \
${{ matrix.backend.cmake_flags }} \
${{ matrix.backend.cmake_flags.kokkos }} \
${{ matrix.backend.cmake_flags.kokkos_fft }} \
${{ matrix.target.cmake_flags }}

- name: Build
Expand All @@ -160,25 +185,84 @@ jobs:
path: tests_${{ matrix.backend.name }}.tar
if: ${{ matrix.target.name == 'native' }}

- name: Install
# consume the project in a dummy project
# ideally, this part should be executed in a different job using almost
# the same `matrix` (minus `target`) as the `build` job and having the
# same `needs` and `if` as the `test` job; this would however make a
# duplicated and error-prone `matrix`, and sharing a `matrix` between
# jobs is currently not possible with GitHub Actions (neither directly,
# nor using YAML anchors, other options were too cumbersome when writing
# this); consequently, this part is just here for now

- name: Prepare as subdirectory
run: |
# prepare kokkos
git clone ./tpls/kokkos ./install_test/as_subdirectory/tpls/kokkos
# prepare kokkos-fft
git clone . ./install_test/as_subdirectory/tpls/kokkos-fft

- name: Configure and build test project as subdirectory
run: |
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --install build
cmake -B install_test/as_subdirectory/build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_C_COMPILER=${{ matrix.backend.compiler.c }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.compiler.cxx }} \
-DCMAKE_CXX_STANDARD=17 \
${{ matrix.backend.cmake_flags.kokkos }} \
${{ matrix.backend.cmake_flags.kokkos_fft }} \
${{ matrix.target.cmake_flags }} \
install_test/as_subdirectory
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --build install_test/as_subdirectory/build

- name: Configure and build test code
# Use the built and installed Kokkos FFT library to build a test code
- name: Configure, build and install Kokkos as library
run: |
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake -B build_test \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_C_COMPILER=${{ matrix.backend.c_compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.cxx_compiler }} \
cmake -B build_kokkos \
-DCMAKE_INSTALL_PREFIX=/work/install \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_C_COMPILER=${{ matrix.backend.compiler.c }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.compiler.cxx }} \
-DCMAKE_CXX_STANDARD=17 \
${{ matrix.backend.cmake_flags.kokkos }} \
tpls/kokkos
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --build build_kokkos -j $(( $(nproc) * 2 + 1 ))
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --install build_kokkos

- name: Configure, build and install KokkosFFT as library
run: |
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake -B build_kokkos_fft \
-DCMAKE_INSTALL_PREFIX=/work/install\
-DCMAKE_PREFIX_PATH=/work/install \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_C_COMPILER=${{ matrix.backend.compiler.c }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.compiler.cxx }} \
-DCMAKE_CXX_STANDARD=17 \
${{ matrix.backend.cmake_flags.kokkos_fft }} \
${{ matrix.target.cmake_flags }}
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --build build_kokkos_fft -j $(( $(nproc) * 2 + 1 ))
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --install build_kokkos_fft

- name: Configure and build test project as library
run: |
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake -B install_test/as_library/build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_PREFIX_PATH=/work/install \
install_test
-DCMAKE_C_COMPILER=${{ matrix.backend.compiler.c }} \
-DCMAKE_CXX_COMPILER=${{ matrix.backend.compiler.cxx }} \
-DCMAKE_CXX_STANDARD=17 \
install_test/as_library
docker run -v ${{ github.workspace }}:/work ghcr.io/cexa-project/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
cmake --build build_test -j $(( $(nproc) * 2 + 1 ))
cmake --build install_test/as_library/build -j $(( $(nproc) * 2 + 1 ))

# test the project
test:
runs-on: ${{ matrix.backend.runner }}

Expand Down
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ set(KOKKOSFFT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(KOKKOSFFT_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(KOKKOSFFT_VERSION_PATCH ${PROJECT_VERSION_PATCH})

set(KOKKOS_REQUIRED_VERSION "4.2.00")
set(KOKKOS_REQUIRED_VERSION 4.2.0)

if (NOT KokkosFFT_ENABLE_INTERNAL_KOKKOS)
# First check, Kokkos is added as subdirectory or not
if(NOT TARGET Kokkos::kokkos)
find_package(Kokkos REQUIRED)
find_package(Kokkos ${KOKKOS_REQUIRED_VERSION} REQUIRED)
endif()

# Kokkos version check
include(Kokkos_Version_Check)
check_minimum_required_kokkos(${KOKKOS_REQUIRED_VERSION})
else ()
add_subdirectory(tpls/kokkos)
endif ()
Expand Down
11 changes: 0 additions & 11 deletions cmake/Kokkos_Version_Check.cmake

This file was deleted.

9 changes: 0 additions & 9 deletions install_test/CMakeLists.txt

This file was deleted.

8 changes: 8 additions & 0 deletions install_test/as_library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22)
project(kokkos-fft-as-library 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)
File renamed without changes.
8 changes: 8 additions & 0 deletions install_test/as_subdirectory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22)
project(kokkos-fft-as-subdirectory 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)
44 changes: 44 additions & 0 deletions install_test/as_subdirectory/hello.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <Kokkos_Core.hpp>
#include <Kokkos_Complex.hpp>
#include <Kokkos_Random.hpp>
#include <KokkosFFT.hpp>

using execution_space = Kokkos::DefaultExecutionSpace;
template <typename T>
using View2D = Kokkos::View<T**, execution_space>;

int main(int argc, char* argv[]) {
Kokkos::initialize(argc, argv);
{
constexpr int n0 = 128, n1 = 128;
const Kokkos::complex<double> I(1.0, 1.0);

// 2D C2C FFT (Forward and Backward)
View2D<Kokkos::complex<double> > xc2c("xc2c", n0, n1);
View2D<Kokkos::complex<double> > xc2c_hat("xc2c_hat", n0, n1);
View2D<Kokkos::complex<double> > xc2c_inv("xc2c_inv", n0, n1);

Kokkos::Random_XorShift64_Pool<> random_pool(12345);
Kokkos::fill_random(xc2c, random_pool, I);

KokkosFFT::fft2(execution_space(), xc2c, xc2c_hat);
KokkosFFT::ifft2(execution_space(), xc2c_hat, xc2c_inv);

// 2D R2C FFT
View2D<double> xr2c("xr2c", n0, n1);
View2D<Kokkos::complex<double> > xr2c_hat("xr2c_hat", n0, n1 / 2 + 1);
Kokkos::fill_random(xr2c, random_pool, 1);

KokkosFFT::rfft2(execution_space(), xr2c, xr2c_hat);

// 2D C2R FFT
View2D<Kokkos::complex<double> > xc2r("xr2c_hat", n0, n1 / 2 + 1);
View2D<double> xc2r_hat("xc2r", n0, n1);
Kokkos::fill_random(xc2r, random_pool, I);

KokkosFFT::irfft2(execution_space(), xc2r, xc2r_hat);
}
Kokkos::finalize();

return 0;
}
Loading