Skip to content

Commit

Permalink
fix icpx OpenMP atomics
Browse files Browse the repository at this point in the history
CI_FILTER: ^linux_icpx
  • Loading branch information
psychocoderHPC committed Dec 21, 2023
1 parent cf105b7 commit aa945e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
21 changes: 11 additions & 10 deletions include/alpaka/atomic/AtomicOmpBuiltIn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,15 @@ namespace alpaka
template<typename T, typename THierarchy>
struct AtomicOp<AtomicMin, AtomicOmpBuiltIn, T, THierarchy>
{
ALPAKA_FN_HOST static auto atomicOp(AtomicOmpBuiltIn const&, T* const addr, T const& value) -> T
ALPAKA_FN_HOST static auto atomicOp(AtomicOmpBuiltIn const&, T* const addr, T value) -> T
{
T old;
auto& ref(*addr);
// atomically update ref, but capture the original value in old
# pragma omp atomic capture compare
{
old = ref;
if(value < ref)
ref = value;
ref = (ref < value) ? ref : value;
}
return old;
}
Expand All @@ -198,16 +197,15 @@ namespace alpaka
template<typename T, typename THierarchy>
struct AtomicOp<AtomicMax, AtomicOmpBuiltIn, T, THierarchy>
{
ALPAKA_FN_HOST static auto atomicOp(AtomicOmpBuiltIn const&, T* const addr, T const& value) -> T
ALPAKA_FN_HOST static auto atomicOp(AtomicOmpBuiltIn const&, T* const addr, T value) -> T
{
T old;
auto& ref(*addr);
// atomically update ref, but capture the original value in old
# pragma omp atomic capture compare
{
old = ref;
if(value > ref)
ref = value;
ref = (ref > value) ? ref : value;
}
return old;
}
Expand Down Expand Up @@ -252,16 +250,19 @@ namespace alpaka
ALPAKA_FN_HOST static auto atomicOp(
AtomicOmpBuiltIn const&,
T* const addr,
T const& compare,
T const& value) -> T
T compare,
T value) -> T
{
T old;
auto& ref(*addr);
// atomically update ref, but capture the original value in old
# pragma omp atomic capture compare
{
old = ref;
ref = (ref == compare ? value : ref);
old = ref == compare;
if(old)
{
ref = compare;
}
}
return old;
}
Expand Down
9 changes: 7 additions & 2 deletions script/install_oneapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ then
# The compiler will automatically pull in OpenMP and TBB as dependencies
components=(
intel-oneapi-common-vars # Contains /opt/intel/oneapi/setvars.sh - has no version number
intel-oneapi-compiler-dpcpp-cpp-"${ALPAKA_CI_ONEAPI_VERSION}" # Contains icpx compiler and SYCL runtime
intel-oneapi-runtime-opencl # Required to run SYCL tests on the CPU - has no version number
intel-oneapi-compiler-dpcpp-cpp-"${ALPAKA_CI_ONEAPI_VERSION}"
intel-oneapi-compiler-dpcpp-cpp-runtime-"${ALPAKA_CI_ONEAPI_VERSION}"
intel-oneapi-compiler-shared-"${ALPAKA_CI_ONEAPI_VERSION}"
intel-oneapi-dpcpp-cpp-"${ALPAKA_CI_ONEAPI_VERSION}"
intel-oneapi-openmp-"${ALPAKA_CI_ONEAPI_VERSION}"
intel-oneapi-openmp-common-"${ALPAKA_CI_ONEAPI_VERSION}"

)
travis_retry sudo apt-get install -y "${components[@]}"

Expand Down
9 changes: 9 additions & 0 deletions script/job_generator/alpaka_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,13 @@ def alpaka_post_filter(row: List) -> bool:
):
return False

# OpenMP is not supported for ipcx < 2024
#if row_check_name(row, HOST_COMPILER, "==", ICPX) and row_check_version(row, HOST_COMPILER, "!=", "2024.0") and (
# row_check_backend_version(row, ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE, "==", ON_VER)
# or row_check_backend_version(
# row, ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE, "==", ON_VER
#)
#):
# return False

return True
6 changes: 3 additions & 3 deletions script/job_generator/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"12.2",
],
HIPCC: ["5.0", "5.1", "5.2", "5.3", "5.4", "5.5"],
ICPX: ["2023.1.0", "2023.2.0"],
ICPX: ["2024.0"],
# Contains all enabled back-ends.
# There are special cases for ALPAKA_ACC_GPU_CUDA_ENABLE and ALPAKA_ACC_GPU_HIP_ENABLE
# which have to be combined with nvcc and hipcc versions.
Expand Down Expand Up @@ -68,8 +68,8 @@
# Turn off OpenMP back-ends until Intel fixes https://github.com/intel/llvm/issues/10711
[
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE,
ALPAKA_ACC_SYCL_ENABLE,
ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE,
ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE
],
],
UBUNTU: ["20.04"],
Expand Down

0 comments on commit aa945e6

Please sign in to comment.