diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f1b8a242e..8aeae5414 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v3 with: repository: kokkos/kokkos - ref: 4.0.00 + ref: 4.1.00 path: ${GITHUB_WORKSPACE}/../kokkos - name: Install Kokkos shell: bash diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index abcbc74ac..e261e2a79 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ BuildKokkos: extends: .LoadModules stage: buildDependencies script: - - git clone --depth=1 --branch 4.0.00 https://github.com/kokkos/kokkos.git && + - git clone --depth=1 --branch 4.1.00 https://github.com/kokkos/kokkos.git && cd kokkos && mkdir build && cd build && diff --git a/.jenkins/continuous.groovy b/.jenkins/continuous.groovy index 76df8c245..78cc08b26 100644 --- a/.jenkins/continuous.groovy +++ b/.jenkins/continuous.groovy @@ -42,7 +42,7 @@ pipeline { dockerfile { filename "Dockerfile" dir "docker" - additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.5.2-devel-ubuntu20.04 --build-arg KOKKOS_VERSION=4.1.00 --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -DKokkos_ARCH_VOLTA70=ON" --build-arg CUDA_AWARE_MPI=1' + additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.5.2-devel-ubuntu20.04 --build-arg KOKKOS_VERSION=4.1.00 --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_VOLTA70=ON" --build-arg CUDA_AWARE_MPI=1' args '-v /tmp/ccache:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}' label 'NVIDIA_Tesla_V100-PCIE-32GB && nvidia-docker' } @@ -102,7 +102,7 @@ pipeline { dockerfile { filename "Dockerfile" dir "docker" - additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.0.3-devel-ubuntu20.04 --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -DKokkos_ARCH_VOLTA70=ON"' + additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.0.3-devel-ubuntu20.04 --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_VOLTA70=ON"' args '-v /tmp/ccache:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}' label 'NVIDIA_Tesla_V100-PCIE-32GB && nvidia-docker' } @@ -161,7 +161,7 @@ pipeline { dockerfile { filename "Dockerfile" dir "docker" - additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.0.3-devel-ubuntu18.04 --build-arg KOKKOS_VERSION="4.1.00" --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_COMPILER=clang++ -DKokkos_ENABLE_THREADS=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -DKokkos_ARCH_VOLTA70=ON -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu"' + additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.0.3-devel-ubuntu18.04 --build-arg KOKKOS_VERSION="4.1.00" --build-arg KOKKOS_OPTIONS="-DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_COMPILER=clang++ -DKokkos_ENABLE_THREADS=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_VOLTA70=ON -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu"' args '-v /tmp/ccache:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}' label 'NVIDIA_Tesla_V100-PCIE-32GB && nvidia-docker' } diff --git a/.jenkins/nightly.groovy b/.jenkins/nightly.groovy index c825d48ee..ad8c7df50 100644 --- a/.jenkins/nightly.groovy +++ b/.jenkins/nightly.groovy @@ -26,7 +26,7 @@ pipeline { dir('source-kokkos') { sh 'git rev-parse --short HEAD' } - sh 'cmake -S source-kokkos -B build-kokkos -D CMAKE_INSTALL_PREFIX=$PWD/install-kokkos $CMAKE_OPTIONS -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ENABLE_CUDA_LAMBDA=ON' + sh 'cmake -S source-kokkos -B build-kokkos -D CMAKE_INSTALL_PREFIX=$PWD/install-kokkos $CMAKE_OPTIONS -D Kokkos_ENABLE_CUDA=ON' sh 'cmake --build build-kokkos --parallel 8' sh 'cmake --install build-kokkos' // Disable tests as Ubuntu 22.04 comes with Boost 1.74 which causes build issues with CUDA @@ -66,7 +66,7 @@ pipeline { dir('source-kokkos') { sh 'git rev-parse --short HEAD' } - sh 'cmake -S source-kokkos -B build-kokkos -D CMAKE_INSTALL_PREFIX=$PWD/install-kokkos $CMAKE_OPTIONS -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ENABLE_CUDA_LAMBDA=ON' + sh 'cmake -S source-kokkos -B build-kokkos -D CMAKE_INSTALL_PREFIX=$PWD/install-kokkos $CMAKE_OPTIONS -D Kokkos_ENABLE_CUDA=ON' sh 'cmake --build build-kokkos --parallel 8' sh 'cmake --install build-kokkos' // Disable tests as Ubuntu 22.04 comes with Boost 1.74 which causes build issues with CUDA diff --git a/CMakeLists.txt b/CMakeLists.txt index 6804b5341..580daefd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,8 @@ cmake_minimum_required(VERSION 3.16) project(ArborX CXX) -find_package(Kokkos 4.0 REQUIRED CONFIG) +find_package(Kokkos 4.1 REQUIRED CONFIG) message(STATUS "Found Kokkos: ${Kokkos_DIR} (version \"${Kokkos_VERSION}\")") -if(Kokkos_ENABLE_CUDA AND Kokkos_VERSION VERSION_LESS 4.1) - # CUDA_LAMBDA is deprecated starting 4.1 - kokkos_check(OPTIONS CUDA_LAMBDA) -endif() add_library(ArborX INTERFACE) target_link_libraries(ArborX INTERFACE Kokkos::kokkos) diff --git a/docker/Dockerfile b/docker/Dockerfile index e2822c0ff..a392a6877 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -131,8 +131,8 @@ RUN SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \ ENV LD_LIBRARY_PATH=/usr/local/cuda/targets/x86_64-linux/lib:${LD_LIBRARY_PATH} # Install Kokkos -ARG KOKKOS_VERSION=4.0.00 -ARG KOKKOS_OPTIONS="-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON" +ARG KOKKOS_VERSION=4.2.00 +ARG KOKKOS_OPTIONS="-DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON" ENV KOKKOS_DIR=/opt/kokkos RUN KOKKOS_URL=https://github.com/kokkos/kokkos/archive/${KOKKOS_VERSION}.tar.gz && \ KOKKOS_ARCHIVE=kokkos-${KOKKOS_HASH}.tar.gz && \ diff --git a/docker/Dockerfile.hipcc b/docker/Dockerfile.hipcc index fb46366a7..7648113f7 100644 --- a/docker/Dockerfile.hipcc +++ b/docker/Dockerfile.hipcc @@ -89,7 +89,7 @@ RUN SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \ rm -rf ${SCRATCH_DIR} # Install Kokkos -ARG KOKKOS_VERSION=4.0.00 +ARG KOKKOS_VERSION=4.2.00 ARG KOKKOS_ARCH=Kokkos_ARCH_VEGA906 ARG KOKKOS_OPTIONS="-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_OPENMP=ON -D${KOKKOS_ARCH}=ON" ENV KOKKOS_DIR=/opt/kokkos diff --git a/docker/Dockerfile.sycl b/docker/Dockerfile.sycl index 9c8e76fd5..298b04b1b 100644 --- a/docker/Dockerfile.sycl +++ b/docker/Dockerfile.sycl @@ -109,7 +109,7 @@ RUN SCRATCH_DIR=/scratch && mkdir -p ${SCRATCH_DIR} && cd ${SCRATCH_DIR} && \ rm -rf ${SCRATCH_DIR} # Install Kokkos -ARG KOKKOS_VERSION=4.1.00 +ARG KOKKOS_VERSION=4.2.00 ARG KOKKOS_OPTIONS="-DKokkos_ENABLE_SYCL=ON -DCMAKE_CXX_FLAGS=-Wno-unknown-cuda-version -DKokkos_ENABLE_UNSUPPORTED_ARCHS=ON -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF -DKokkos_ARCH_VOLTA70=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS=-w" ENV KOKKOS_DIR=/opt/kokkos RUN . /opt/intel/oneapi/setvars.sh --include-intel-llvm && \ diff --git a/docker/README.md b/docker/README.md index 93d036e16..a2a7a01dc 100644 --- a/docker/README.md +++ b/docker/README.md @@ -3,7 +3,7 @@ in the environment file. Its value will be prepended along with the service name to the container on start up. -You may use multiple compose files to customize your container. For instance, you +You may use multiple compose files to customize your container. For instance, you could reproduce the configuration from one of the automated builds by providing the following a `docker-compose.override.yml` file: ``` @@ -13,6 +13,6 @@ services: build: args: - BASE=nvidia/cuda:11.5.2-devel-ubuntu20.04 - - KOKKOS_VERSION=4.0.00 - - KOKKOS_OPTIONS=-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -DKokkos_ARCH_SNB=ON -DKokkos_ARCH_VOLTA70=ON + - KOKKOS_VERSION=4.2.00 + - KOKKOS_OPTIONS=-DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_SNB=ON -DKokkos_ARCH_VOLTA70=ON ``` diff --git a/src/ArborX_BruteForce.hpp b/src/ArborX_BruteForce.hpp index b59d1adb2..8e6cc6c91 100644 --- a/src/ArborX_BruteForce.hpp +++ b/src/ArborX_BruteForce.hpp @@ -18,11 +18,11 @@ #include #include #include -#include #include #include #include +#include namespace ArborX { @@ -69,7 +69,7 @@ class BasicBruteForce query(ExecutionSpace const &space, Predicates const &predicates, CallbackOrView &&callback_or_view, View &&view, Args &&...args) const { - KokkosExt::ScopedProfileRegion guard("ArborX::BruteForce::query_crs"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BruteForce::query_crs"); Details::CrsGraphWrapperImpl:: check_valid_callback_if_first_argument_is_not_a_view( @@ -156,7 +156,7 @@ class BruteForce } else { - KokkosExt::ScopedProfileRegion guard("ArborX::BruteForce::query_crs"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BruteForce::query_crs"); Kokkos::View indices( "ArborX::CrsGraphWrapper::query::indices", 0); @@ -194,7 +194,7 @@ BasicBruteForce:: ExecutionSpace>::value, "Values must be accessible from the execution space"); - KokkosExt::ScopedProfileRegion guard("ArborX::BruteForce::BruteForce"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BruteForce::BruteForce"); if (empty()) { diff --git a/src/ArborX_HDBSCAN.hpp b/src/ArborX_HDBSCAN.hpp index b06ed4671..38342e89a 100644 --- a/src/ArborX_HDBSCAN.hpp +++ b/src/ArborX_HDBSCAN.hpp @@ -12,9 +12,10 @@ #define ARBORX_HDBSCAN_HPP #include -#include #include +#include + namespace ArborX::Experimental { @@ -24,7 +25,7 @@ auto hdbscan(ExecutionSpace const &exec_space, Primitives const &primitives, DendrogramImplementation dendrogram_impl = DendrogramImplementation::BORUVKA) { - KokkosExt::ScopedProfileRegion guard("ArborX::HDBSCAN"); + Kokkos::Profiling::ScopedRegion guard("ArborX::HDBSCAN"); using namespace ArborX::Details; diff --git a/src/ArborX_LinearBVH.hpp b/src/ArborX_LinearBVH.hpp index 6a5e20911..757d6c346 100644 --- a/src/ArborX_LinearBVH.hpp +++ b/src/ArborX_LinearBVH.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include #include +#include namespace ArborX { @@ -93,7 +93,7 @@ class BasicBoundingVolumeHierarchy query(ExecutionSpace const &space, Predicates const &predicates, CallbackOrView &&callback_or_view, View &&view, Args &&...args) const { - KokkosExt::ScopedProfileRegion guard("ArborX::BVH::query_crs"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BVH::query_crs"); Details::CrsGraphWrapperImpl:: check_valid_callback_if_first_argument_is_not_a_view( @@ -206,7 +206,7 @@ class BoundingVolumeHierarchy } else { - KokkosExt::ScopedProfileRegion guard("ArborX::BVH::query_crs"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BVH::query_crs"); Kokkos::View indices( "ArborX::CrsGraphWrapper::query::indices", 0); @@ -266,7 +266,7 @@ BasicBoundingVolumeHierarchy(curve); - KokkosExt::ScopedProfileRegion guard("ArborX::BVH::BVH"); + Kokkos::Profiling::ScopedRegion guard("ArborX::BVH::BVH"); if (empty()) { diff --git a/src/details/ArborX_DetailsDistributedTreeImpl.hpp b/src/details/ArborX_DetailsDistributedTreeImpl.hpp index d65c37be8..3e0be01aa 100644 --- a/src/details/ArborX_DetailsDistributedTreeImpl.hpp +++ b/src/details/ArborX_DetailsDistributedTreeImpl.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -28,6 +27,7 @@ #include #include +#include #include @@ -249,7 +249,7 @@ DistributedTreeImpl::sendAcrossNetwork( ExecutionSpace const &space, Distributor const &distributor, View exports, typename View::non_const_type imports) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::sendAcrossNetwork (" + exports.label() + ")"); ARBORX_ASSERT((exports.extent(0) == distributor.getTotalSendLength()) && @@ -319,7 +319,7 @@ void DistributedTreeImpl::deviseStrategy( ExecutionSpace const &space, Predicates const &queries, DistributedTree const &tree, Indices &indices, Offset &offset, Distances &) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::deviseStrategy"); auto const &top_tree = tree._top_tree; @@ -381,7 +381,7 @@ void DistributedTreeImpl::reassessStrategy( DistributedTree const &tree, Indices &indices, Offset &offset, Distances &distances) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::reassessStrategy"); auto const &top_tree = tree._top_tree; @@ -487,7 +487,7 @@ DistributedTreeImpl::queryDispatchImpl( ExecutionSpace const &space, Predicates const &queries, Indices &indices, Offset &offset, Ranks &ranks, Distances *distances_ptr) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::query::nearest"); auto const &bottom_tree = tree._bottom_tree; @@ -590,7 +590,7 @@ DistributedTreeImpl::queryDispatch( ExecutionSpace const &space, Predicates const &queries, Callback const &callback, OutputView &out, OffsetView &offset) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::query::spatial"); auto const &top_tree = tree._top_tree; @@ -701,7 +701,7 @@ void DistributedTreeImpl::forwardQueries( Kokkos::View &fwd_queries, Kokkos::View &fwd_ids, Ranks &fwd_ranks) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::forwardQueries"); int comm_rank; @@ -794,7 +794,7 @@ void DistributedTreeImpl::communicateResultsBack( Kokkos::View offset, Ranks &ranks, Kokkos::View &ids, Distances *distances_ptr) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::communicateResultsBack"); int comm_rank; @@ -882,7 +882,7 @@ void DistributedTreeImpl::filterResults( Kokkos::View distances, Indices &indices, Offset &offset, Ranks &ranks) { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::DistributedTree::filterResults"); using Access = AccessTraits; diff --git a/src/details/ArborX_DetailsMinimumSpanningTree.hpp b/src/details/ArborX_DetailsMinimumSpanningTree.hpp index 85966b014..a4e752620 100644 --- a/src/details/ArborX_DetailsMinimumSpanningTree.hpp +++ b/src/details/ArborX_DetailsMinimumSpanningTree.hpp @@ -15,15 +15,15 @@ #include #include #include -#include #include -#include #include #include #include +#include #include #include // isfinite, signbit +#include namespace ArborX::Details { @@ -503,7 +503,7 @@ void updateSidedParents(ExecutionSpace const &space, Labels const &labels, SidedParents &sided_parents, int edges_start, int edges_end) { - KokkosExt::ScopedProfileRegion guard("ArborX::MST::update_sided_parents"); + Kokkos::Profiling::ScopedRegion guard("ArborX::MST::update_sided_parents"); // Same as dendrogram alpha's standalone "updateSidedParents" Kokkos::parallel_for( @@ -559,7 +559,7 @@ template (edge.weight); + keys(e) = (key << shift) + Kokkos::bit_cast(edge.weight); }); auto permute = sortObjects(space, keys); diff --git a/src/details/ArborX_MinimumSpanningTree.hpp b/src/details/ArborX_MinimumSpanningTree.hpp index 03bfce8d8..aed05fe90 100644 --- a/src/details/ArborX_MinimumSpanningTree.hpp +++ b/src/details/ArborX_MinimumSpanningTree.hpp @@ -13,7 +13,6 @@ #define ARBORX_MINIMUM_SPANNING_TREE_HPP #include -#include #include #include #include @@ -22,6 +21,9 @@ #include #include +#include +#include + namespace ArborX::Details { @@ -230,7 +232,7 @@ struct MinimumSpanningTree edges_start, edges_end); else { - KokkosExt::ScopedProfileRegion guard( + Kokkos::Profiling::ScopedRegion guard( "ArborX::MST::compute_vertex_parents"); assignVertexParents(space, labels, component_out_edges, edges_mapping, bvh, dendrogram_parents); diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtBitManipulation.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtBitManipulation.hpp deleted file mode 100644 index f4b83d187..000000000 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtBitManipulation.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2023 by the ArborX authors * - * All rights reserved. * - * * - * This file is part of the ArborX library. ArborX is * - * distributed under a BSD 3-clause license. For the licensing terms see * - * the LICENSE file in the top-level directory. * - * * - * SPDX-License-Identifier: BSD-3-Clause * - ****************************************************************************/ - -#ifndef ARBORX_DETAILS_KOKKOS_EXT_BIT_MANIPULATION_HPP -#define ARBORX_DETAILS_KOKKOS_EXT_BIT_MANIPULATION_HPP - -#include -#if KOKKOS_VERSION >= 40100 -#include -#endif - -#include - -namespace KokkosExt -{ - -#if KOKKOS_VERSION >= 40100 -using Kokkos::bit_cast; -#else -template -KOKKOS_FUNCTION std::enable_if_t && - std::is_trivially_copyable_v, - To> -bit_cast(From const &from) noexcept -{ - To to; - memcpy(&to, &from, sizeof(To)); - return to; -} -#endif - -} // namespace KokkosExt - -#endif diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtScopedProfileRegion.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtScopedProfileRegion.hpp deleted file mode 100644 index c4de6e21c..000000000 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtScopedProfileRegion.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2017-2023 by the ArborX authors * - * All rights reserved. * - * * - * This file is part of the ArborX library. ArborX is * - * distributed under a BSD 3-clause license. For the licensing terms see * - * the LICENSE file in the top-level directory. * - * * - * SPDX-License-Identifier: BSD-3-Clause * - ****************************************************************************/ - -#ifndef ARBORX_DETAILS_KOKKOS_EXT_SCOPED_PROFILE_REGION_HPP -#define ARBORX_DETAILS_KOKKOS_EXT_SCOPED_PROFILE_REGION_HPP - -#include - -#if KOKKOS_VERSION >= 40099 -#include -namespace KokkosExt -{ -using ScopedProfileRegion = Kokkos::Profiling::ScopedRegion; -} -#else -#include - -#include - -namespace KokkosExt -{ - -class ScopedProfileRegion -{ -public: - ScopedProfileRegion(ScopedProfileRegion const &) = delete; - ScopedProfileRegion &operator=(ScopedProfileRegion const &) = delete; - - explicit ScopedProfileRegion(std::string const &name) - { - Kokkos::Profiling::pushRegion(name); - } - ~ScopedProfileRegion() { Kokkos::Profiling::popRegion(); } -}; - -} // namespace KokkosExt -#endif - -#endif diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtSort.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtSort.hpp index ac4b54643..4560299ca 100644 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtSort.hpp +++ b/src/kokkos_ext/ArborX_DetailsKokkosExtSort.hpp @@ -14,9 +14,9 @@ #include // ARBORX_ENABLE_ROCTHRUST -#include #include // minMax +#include #include // clang-format off @@ -79,7 +79,7 @@ namespace KokkosExt template void sortByKey(ExecutionSpace const &space, Keys &keys, Values &values) { - KokkosExt::ScopedProfileRegion guard("ArborX::KokkosExt::sortByKey::Kokkos"); + Kokkos::Profiling::ScopedRegion guard("ArborX::KokkosExt::sortByKey::Kokkos"); static_assert(Kokkos::is_view::value); static_assert(Kokkos::is_view::value); @@ -120,7 +120,7 @@ void sortByKey( #endif Keys &keys, Values &values) { - KokkosExt::ScopedProfileRegion guard("ArborX::KokkosExt::sortByKey::Thrust"); + Kokkos::Profiling::ScopedRegion guard("ArborX::KokkosExt::sortByKey::Thrust"); using ExecutionSpace = std::decay_t; static_assert(Kokkos::is_view::value); @@ -153,7 +153,7 @@ template void sortByKey(Kokkos::Experimental::SYCL const &space, Keys &keys, Values &values) { - KokkosExt::ScopedProfileRegion guard("ArborX::KokkosExt::sortByKey::OneDPL"); + Kokkos::Profiling::ScopedRegion guard("ArborX::KokkosExt::sortByKey::OneDPL"); using ExecutionSpace = std::decay_t; static_assert(Kokkos::is_view::value); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e9abe4b61..c56e5e5db 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -146,9 +146,6 @@ list(APPEND ARBORX_TEST_QUERY_TREE_SOURCES tstKokkosToolsAnnotations.cpp utf_main.cpp ) -if (Kokkos_VERSION VERSION_LESS 4.0.99) - list(APPEND ARBORX_TEST_QUERY_TREE_SOURCES tstScopedProfileRegion.cpp) -endif() add_executable(ArborX_Test_QueryTree.exe ${ARBORX_TEST_QUERY_TREE_SOURCES}) target_link_libraries(ArborX_Test_QueryTree.exe PRIVATE ArborX Boost::unit_test_framework) target_compile_definitions(ArborX_Test_QueryTree.exe PRIVATE BOOST_TEST_DYN_LINK) diff --git a/test/tstScopedProfileRegion.cpp b/test/tstScopedProfileRegion.cpp deleted file mode 100644 index d59292a00..000000000 --- a/test/tstScopedProfileRegion.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2017-2022 by the ArborX authors * - * All rights reserved. * - * * - * This file is part of the ArborX library. ArborX is * - * distributed under a BSD 3-clause license. For the licensing terms see * - * the LICENSE file in the top-level directory. * - * * - * SPDX-License-Identifier: BSD-3-Clause * - ****************************************************************************/ - -#include - -#include - -#include -#include -#include - -namespace -{ -std::stack arborx_test_region_stack; - -// NOTE: cannot use lambdas because they can only be converted to function -// pointers if they don't capture anything -void arborx_test_push_region(char const *label) -{ - BOOST_TEST_MESSAGE(std::string("push ") + label); - arborx_test_region_stack.push(label); -} - -void arborx_test_pop_region() -{ - auto const &label = arborx_test_region_stack.top(); - BOOST_TEST_MESSAGE(std::string("pop ") + label); - arborx_test_region_stack.pop(); -} - -} // namespace - -BOOST_AUTO_TEST_SUITE(KokkosToolsAnnotations) - -BOOST_AUTO_TEST_CASE(scoped_profile_region) -{ - Kokkos::Tools::Experimental::set_push_region_callback( - arborx_test_push_region); - Kokkos::Tools::Experimental::set_pop_region_callback(arborx_test_pop_region); - - BOOST_TEST(arborx_test_region_stack.empty()); - - // Unnamed guard! Profile region is popped at the end of the statement. - KokkosExt::ScopedProfileRegion("bug"); - - BOOST_TEST(arborx_test_region_stack.empty()); - - { - std::string outer_identifier = "outer"; - KokkosExt::ScopedProfileRegion guard_outer(outer_identifier); - - BOOST_TEST(arborx_test_region_stack.size() == 1); - BOOST_TEST(arborx_test_region_stack.top() == outer_identifier); - - { - std::string inner_identifier = "inner"; - KokkosExt::ScopedProfileRegion guard_inner(inner_identifier); - BOOST_TEST(arborx_test_region_stack.size() == 2); - BOOST_TEST(arborx_test_region_stack.top() == inner_identifier); - } - - BOOST_TEST(arborx_test_region_stack.size() == 1); - BOOST_TEST(arborx_test_region_stack.top() == outer_identifier); - } - - BOOST_TEST(arborx_test_region_stack.empty()); - - // Unset callbacks - Kokkos::Tools::Experimental::set_push_region_callback(nullptr); - Kokkos::Tools::Experimental::set_pop_region_callback(nullptr); -} - -static_assert( - !std::is_default_constructible::value); -static_assert( - !std::is_copy_constructible::value); -static_assert( - !std::is_move_constructible::value); -static_assert(!std::is_copy_assignable::value); -static_assert(!std::is_move_assignable::value); - -BOOST_AUTO_TEST_SUITE_END()