diff --git a/.github/ci_plugin_install.sh b/.github/ci_plugin_install.sh new file mode 100755 index 0000000000..2deb4dd40e --- /dev/null +++ b/.github/ci_plugin_install.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# TRACCC library, part of the ACTS project (R&D line) +# +# (c) 2024 CERN for the benefit of the ACTS project +# +# Mozilla Public License Version 2.0 +# +# This is a (hopefully) temporary script for installing the CodePlay oneAPI +# plugins for the SYCL tests. +# + +# The platform name. +PLATFORM_NAME=$1 + +# Do the installation(s) when on a SYCL platform, and with the installation +# being under /opt/intel/oneapi. +if [ "${PLATFORM_NAME}" = "SYCL" ]; then + if [ -d "/opt/intel/oneapi" ]; then + curl -SL "https://developer.codeplay.com/api/v1/products/download?product=oneapi&variant=nvidia&version=2024.1.0" \ + -o nvidia_plugin.sh + sh nvidia_plugin.sh -i /opt/intel/oneapi -y + rm nvidia_plugin.sh + curl -SL "https://developer.codeplay.com/api/v1/products/download?product=oneapi&variant=amd&version=2024.1.0" \ + -o amd_plugin.sh + sh amd_plugin.sh -i /opt/intel/oneapi -y + rm amd_plugin.sh + fi +fi diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a723819dc8..35e1928887 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,105 @@ # TRACCC library, part of the ACTS project (R&D line) # -# (c) 2022-2023 CERN for the benefit of the ACTS project +# (c) 2022-2024 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 +# The list of build satages. stages: - build - test +# Base job template. +.base_template: &base_job + before_script: + - git clone $CLONE_URL src + - git -C src checkout $HEAD_SHA + - source ./src/.github/ci_setup.sh ${TRACCC_BUILD_TYPE} + - ./src/.github/ci_plugin_install.sh ${TRACCC_BUILD_TYPE} -build_cuda: +# Build job template. +.build_template: &build_job + <<: *base_job tags: [docker] stage: build - image: ghcr.io/acts-project/ubuntu2004_cuda:v30 artifacts: paths: - build script: - - git clone $CLONE_URL src - - git -C src checkout $HEAD_SHA - - cmake --preset cuda -DCMAKE_BUILD_TYPE=Release -S src -B build -G Ninja - - cmake --build build --parallel 2 + - cmake -G Ninja --preset ${TRACCC_BUILD_PRESET} -DCMAKE_BUILD_TYPE=Release + -DTRACCC_BUILD_EXAMPLES=FALSE ${TRACCC_CMAKE_ARGS} + -S src -B build + - cmake --build build --parallel 2 -test_cuda: - stage: test +# Test job template for running on an NVIDIA GPU. +.nvidia_test_template: &nvidia_test_job + <<: *base_job tags: [docker-gpu-nvidia] - image: ghcr.io/acts-project/ubuntu2004_cuda:v30 - needs: - - build_cuda + stage: test script: - - git clone $CLONE_URL src - - cd src - - git checkout $HEAD_SHA - - data/traccc_data_get_files.sh - - cd .. - - cd build - nvidia-smi - - ctest --output-on-failure -E "^SeedingValidation/CompareWithActsSeedingTests.*" + - ./src/data/traccc_data_get_files.sh + - ctest --output-on-failure --test-dir build/ -R "${TRACCC_BUILD_TYPE}" + +# Test job template for running on an Intel device. +.intel_test_template: &intel_test_job + <<: *base_job + tags: [docker-gpu-nvidia] + stage: test + script: + - ./src/data/traccc_data_get_files.sh + - ctest --output-on-failure --test-dir build/ -R "${TRACCC_BUILD_TYPE}" + +# CUDA build job. +build:cuda: + <<: *build_job + image: ghcr.io/acts-project/ubuntu2004_cuda:47 + variables: + TRACCC_BUILD_TYPE: CUDA + TRACCC_BUILD_PRESET: cuda + +# CUDA test job. +test:cuda: + <<: *nvidia_test_job + image: ghcr.io/acts-project/ubuntu2004_cuda:47 + variables: + TRACCC_BUILD_TYPE: CUDA + dependencies: + - build:cuda + +# SYCL build job (with an Intel backend). +build:sycl_intel: + <<: *build_job + image: ghcr.io/acts-project/ubuntu2004_oneapi:47 + variables: + TRACCC_BUILD_TYPE: SYCL + TRACCC_BUILD_PRESET: sycl + +# SYCL test job (with an Intel backend). +test:sycl_intel: + <<: *intel_test_job + image: ghcr.io/acts-project/ubuntu2004_oneapi:47 + variables: + TRACCC_BUILD_TYPE: SYCL + ONEAPI_DEVICE_SELECTOR: opencl:* + dependencies: + - build:sycl_intel + +# SYCL build job (with an NVIDIA backend). +build:sycl_nvidia: + <<: *build_job + image: ghcr.io/acts-project/ubuntu2004_cuda_oneapi:47 + variables: + TRACCC_BUILD_TYPE: SYCL + TRACCC_BUILD_PRESET: sycl + TRACCC_CMAKE_ARGS: -DTRACCC_BUILD_CUDA=FALSE + +# SYCL test job (with an NVIDIA backend). +test:sycl_nvidia: + <<: *nvidia_test_job + image: ghcr.io/acts-project/ubuntu2004_cuda_oneapi:47 + variables: + TRACCC_BUILD_TYPE: SYCL + ONEAPI_DEVICE_SELECTOR: cuda:* + dependencies: + - build:sycl_nvidia diff --git a/tests/cuda/test_cca.cpp b/tests/cuda/test_cca.cpp index a506ddcee2..bca176547c 100644 --- a/tests/cuda/test_cca.cpp +++ b/tests/cuda/test_cca.cpp @@ -62,7 +62,7 @@ TEST_P(ConnectedComponentAnalysisTests, Run) { } INSTANTIATE_TEST_SUITE_P( - FastSvAlgorithm, ConnectedComponentAnalysisTests, + CUDAFastSvAlgorithm, ConnectedComponentAnalysisTests, ::testing::Combine( ::testing::Values(f), ::testing::ValuesIn(ConnectedComponentAnalysisTests::get_test_files())), diff --git a/tests/cuda/test_ckf_combinatorics_telescope.cpp b/tests/cuda/test_ckf_combinatorics_telescope.cpp index b7b1c55233..f7d323aab2 100644 --- a/tests/cuda/test_ckf_combinatorics_telescope.cpp +++ b/tests/cuda/test_ckf_combinatorics_telescope.cpp @@ -243,20 +243,18 @@ TEST_P(CudaCkfCombinatoricsTelescopeTests, Run) { // Testing two identical tracks INSTANTIATE_TEST_SUITE_P( - CudaCkfCombinatoricsTelescopeValidation0, - CudaCkfCombinatoricsTelescopeTests, - ::testing::Values(std::make_tuple( - "telescope_combinatorics_twin", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{100.f, 100.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 2, 1))); - -// Testing three identical tracks -INSTANTIATE_TEST_SUITE_P( - CudaCkfCombinatoricsTelescopeValidation1, - CudaCkfCombinatoricsTelescopeTests, - ::testing::Values(std::make_tuple( - "telescope_combinatorics_trio", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{100.f, 100.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 3, 1))); \ No newline at end of file + CUDACkfCombinatoricsTelescopeValidation, CudaCkfCombinatoricsTelescopeTests, + ::testing::Values(std::make_tuple("telescope_combinatorics_twin", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{100.f, 100.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 2, + 1), + std::make_tuple("telescope_combinatorics_trio", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{100.f, 100.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 3, + 1))); diff --git a/tests/cuda/test_ckf_toy_detector.cpp b/tests/cuda/test_ckf_toy_detector.cpp index c409daad38..db121d3d96 100644 --- a/tests/cuda/test_ckf_toy_detector.cpp +++ b/tests/cuda/test_ckf_toy_detector.cpp @@ -238,21 +238,21 @@ TEST_P(CkfToyDetectorTests, Run) { } INSTANTIATE_TEST_SUITE_P( - CkfToyDetectorValidation0, CkfToyDetectorTests, - ::testing::Values(std::make_tuple( - "toy_n_particles_1", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{1.f, 100.f}, std::array{-4.f, 4.f}, - std::array{-detray::constant::pi, - detray::constant::pi}, - -1.f, 1, 1))); - -INSTANTIATE_TEST_SUITE_P( - CkfToyDetectorValidation1, CkfToyDetectorTests, - ::testing::Values(std::make_tuple( - "toy_n_particles_10000", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{1.f, 100.f}, std::array{-4.f, 4.f}, - std::array{-detray::constant::pi, - detray::constant::pi}, - -1.f, 10000, 1))); + CUDACkfToyDetectorValidation, CkfToyDetectorTests, + ::testing::Values( + std::make_tuple("toy_n_particles_1", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{1.f, 100.f}, + std::array{-4.f, 4.f}, + std::array{-detray::constant::pi, + detray::constant::pi}, + -1.f, 1, 1), + std::make_tuple("toy_n_particles_10000", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{1.f, 100.f}, + std::array{-4.f, 4.f}, + std::array{-detray::constant::pi, + detray::constant::pi}, + -1.f, 10000, 1))); diff --git a/tests/cuda/test_kalman_fitter_telescope.cpp b/tests/cuda/test_kalman_fitter_telescope.cpp index 77fb539887..2c9fe5f4f3 100644 --- a/tests/cuda/test_kalman_fitter_telescope.cpp +++ b/tests/cuda/test_kalman_fitter_telescope.cpp @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2022-2023 CERN for the benefit of the ACTS project + * (c) 2022-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -217,25 +217,23 @@ TEST_P(KalmanFittingTelescopeTests, Run) { } INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation0, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "cuda_telescope_1_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, std::array{1.f, 1.f}, - std::array{0.f, 0.f}, std::array{0.f, 0.f}, - -1.f, 100, 100))); - -INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation1, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "cuda_telescope_10_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{10.f, 10.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 100, 100))); - -INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation2, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "cuda_telescope_100_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{100.f, 100.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 100, 100))); + CUDAKalmanFitTelescopeValidation, KalmanFittingTelescopeTests, + ::testing::Values( + std::make_tuple("cuda_telescope_1_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{1.f, 1.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100), + std::make_tuple("cuda_telescope_10_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{10.f, 10.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100), + std::make_tuple("cuda_telescope_100_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{100.f, 100.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100))); diff --git a/tests/cuda/test_spacepoint_formation.cpp b/tests/cuda/test_spacepoint_formation.cpp index 5950b54597..0c2be717c4 100644 --- a/tests/cuda/test_spacepoint_formation.cpp +++ b/tests/cuda/test_spacepoint_formation.cpp @@ -25,7 +25,7 @@ using namespace traccc; -TEST(spacepoint_formation, cuda) { +TEST(CUDASpacepointFormation, cuda) { // Memory resource used by the EDM. vecmem::cuda::managed_memory_resource mng_mr; diff --git a/tests/cuda/test_thrust.cu b/tests/cuda/test_thrust.cu index 4e334fd462..468ec49bc2 100644 --- a/tests/cuda/test_thrust.cu +++ b/tests/cuda/test_thrust.cu @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -32,7 +32,7 @@ vecmem::cuda::device_memory_resource device_resource; } // namespace -TEST(thrust, sort) { +TEST(CUDAThrust, sort) { vecmem::vector host_vector{{3, 2, 1, 8, 4}, &host_resource}; @@ -53,7 +53,7 @@ TEST(thrust, sort) { ASSERT_EQ(host_vector[4], 8); } -TEST(thrust, scan) { +TEST(CUDAThrust, scan) { vecmem::vector host_vector{{3, 2, 1, 8, 4}, &host_resource}; @@ -75,7 +75,7 @@ TEST(thrust, scan) { ASSERT_EQ(host_vector[4], 18); } -TEST(thrust, fill) { +TEST(CUDAThrust, fill) { vecmem::vector host_vector{{1, 1, 1, 1, 1, 1, 1}, &host_resource}; @@ -98,4 +98,4 @@ TEST(thrust, fill) { ASSERT_EQ(host_vector[4], 112); ASSERT_EQ(host_vector[5], 112); ASSERT_EQ(host_vector[6], 112); -} \ No newline at end of file +} diff --git a/tests/sycl/test_kalman_fitter_telescope.sycl b/tests/sycl/test_kalman_fitter_telescope.sycl index 65250a08a0..bd980f9542 100644 --- a/tests/sycl/test_kalman_fitter_telescope.sycl +++ b/tests/sycl/test_kalman_fitter_telescope.sycl @@ -1,6 +1,6 @@ /** TRACCC library, part of the ACTS project (R&D line) * - * (c) 2022-2023 CERN for the benefit of the ACTS project + * (c) 2022-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -224,25 +224,23 @@ TEST_P(KalmanFittingTelescopeTests, Run) { } INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation0, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "sycl_telescope_1_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, std::array{1.f, 1.f}, - std::array{0.f, 0.f}, std::array{0.f, 0.f}, - -1.f, 100, 100))); - -INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation1, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "sycl_telescope_10_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{10.f, 10.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 100, 100))); - -INSTANTIATE_TEST_SUITE_P( - KalmanFitTelescopeValidation2, KalmanFittingTelescopeTests, - ::testing::Values(std::make_tuple( - "sycl_telescope_100_GeV_0_phi", std::array{0.f, 0.f, 0.f}, - std::array{0.f, 0.f, 0.f}, - std::array{100.f, 100.f}, std::array{0.f, 0.f}, - std::array{0.f, 0.f}, -1.f, 100, 100))); + SYCLKalmanFitTelescopeValidation, KalmanFittingTelescopeTests, + ::testing::Values( + std::make_tuple("sycl_telescope_1_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{1.f, 1.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100), + std::make_tuple("sycl_telescope_10_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{10.f, 10.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100), + std::make_tuple("sycl_telescope_100_GeV_0_phi", + std::array{0.f, 0.f, 0.f}, + std::array{0.f, 0.f, 0.f}, + std::array{100.f, 100.f}, + std::array{0.f, 0.f}, + std::array{0.f, 0.f}, -1.f, 100, 100))); diff --git a/tests/sycl/test_spacepoint_formation.sycl b/tests/sycl/test_spacepoint_formation.sycl index 7a290f7a3b..703db573f8 100644 --- a/tests/sycl/test_spacepoint_formation.sycl +++ b/tests/sycl/test_spacepoint_formation.sycl @@ -38,7 +38,7 @@ auto handle_async_error = [](::sycl::exception_list elist) { } }; -TEST(spacepoint_formation, sycl) { +TEST(SYCLSpacepointFormation, sycl) { // Memory resource used by the EDM. vecmem::sycl::shared_memory_resource shared_mr;