Skip to content

Commit c1952cd

Browse files
committed
Merge C++ Standard Parallelism implementations
1 parent 9ff46ec commit c1952cd

15 files changed

+263
-698
lines changed

Diff for: CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ include(cmake/register_models.cmake)
154154
register_model(serial SERIAL SerialStream.cpp)
155155
register_model(omp OMP OMPStream.cpp)
156156
register_model(ocl OCL OCLStream.cpp)
157-
register_model(std-data STD_DATA STDDataStream.cpp)
158-
register_model(std-indices STD_INDICES STDIndicesStream.cpp)
159-
register_model(std-ranges STD_RANGES STDRangesStream.cpp)
157+
register_model(std STD STDStream.cpp)
160158
register_model(hip HIP HIPStream.cpp)
161159
register_model(cuda CUDA CUDAStream.cu)
162160
register_model(kokkos KOKKOS KokkosStream.cpp)

Diff for: src/Stream.h

+3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
#pragma once
99

10+
#include <cstdint>
1011
#include <array>
1112
#include <vector>
1213
#include <string>
1314
#include "benchmark.h"
1415

16+
using std::intptr_t;
17+
1518
template <class T>
1619
class Stream
1720
{

Diff for: src/StreamModels.h

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33

44
#if defined(CUDA)
55
#include "CUDAStream.h"
6-
#elif defined(STD_DATA)
7-
#include "STDDataStream.h"
8-
#elif defined(STD_INDICES)
9-
#include "STDIndicesStream.h"
10-
#elif defined(STD_RANGES)
11-
#include "STDRangesStream.hpp"
6+
#elif defined(STD)
7+
#include "STDStream.h"
128
#elif defined(TBB)
139
#include "TBBStream.hpp"
1410
#elif defined(THRUST)
@@ -63,17 +59,9 @@ std::unique_ptr<Stream<T>> make_stream(Args... args) {
6359
// Use the Kokkos implementation
6460
return std::make_unique<KokkosStream<T>>(args...);
6561

66-
#elif defined(STD_DATA)
62+
#elif defined(STD)
6763
// Use the C++ STD data-oriented implementation
68-
return std::make_unique<STDDataStream<T>>(args...);
69-
70-
#elif defined(STD_INDICES)
71-
// Use the C++ STD index-oriented implementation
72-
return std::make_unique<STDIndicesStream<T>>(args...);
73-
74-
#elif defined(STD_RANGES)
75-
// Use the C++ STD ranges implementation
76-
return std::make_unique<STDRangesStream<T>>(args...);
64+
return std::make_unique<STDStream<T>>(args...);
7765

7866
#elif defined(TBB)
7967
// Use the C++20 implementation

Diff for: src/ci-test-compile.sh

+11-8
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ build_gcc() {
152152
*) dpl_conditional_flags="-DFETCH_ONEDPL=ON -DFETCH_TBB=ON -DUSE_TBB=ON -DCXX_EXTRA_FLAGS=-D_GLIBCXX_USE_TBB_PAR_BACKEND=0" ;;
153153
esac
154154
# some distributions like Ubuntu bionic implements std par with TBB, so conditionally link it here
155-
run_build $name "${GCC_CXX:?}" std-data "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl"
156-
run_build $name "${GCC_CXX:?}" std-indices "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl"
157-
run_build $name "${GCC_CXX:?}" std-ranges "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl"
155+
run_build $name "${GCC_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=DATA17"
156+
run_build $name "${GCC_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=DATA20"
157+
run_build $name "${GCC_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=INDICES"
158158
done
159159

160160
run_build $name "${GCC_CXX:?}" tbb "$cxx -DONE_TBB_DIR=$TBB_LIB"
@@ -251,9 +251,10 @@ build_clang() {
251251
OFF) dpl_conditional_flags="-DCXX_EXTRA_LIBRARIES=${CLANG_STD_PAR_LIB:-}" ;;
252252
*) dpl_conditional_flags="-DFETCH_ONEDPL=ON -DFETCH_TBB=ON -DUSE_TBB=ON -DCXX_EXTRA_FLAGS=-D_GLIBCXX_USE_TBB_PAR_BACKEND=0" ;;
253253
esac
254-
run_build $name "${CLANG_CXX:?}" std-data "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl"
255-
run_build $name "${CLANG_CXX:?}" std-indices "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl"
256-
# run_build $name "${CLANG_CXX:?}" std-ranges "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl" # not yet supported
254+
run_build $name "${CLANG_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=DATA17"
255+
# Requires GCC 14
256+
# run_build $name "${CLANG_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=DATA20"
257+
run_build $name "${CLANG_CXX:?}" std "$cxx $dpl_conditional_flags -DUSE_ONEDPL=$use_onedpl -DSTDIMPL=INDICES"
257258
done
258259

259260
run_build $name "${CLANG_CXX:?}" tbb "$cxx -DONE_TBB_DIR=$TBB_LIB"
@@ -270,8 +271,10 @@ build_clang() {
270271
build_nvhpc() {
271272
local name="nvhpc_build"
272273
local cxx="-DCMAKE_CXX_COMPILER=${NVHPC_NVCXX:?}"
273-
run_build $name "${NVHPC_NVCXX:?}" std-data "$cxx -DNVHPC_OFFLOAD=$NV_ARCH_CCXY"
274-
run_build $name "${NVHPC_NVCXX:?}" std-indices "$cxx -DNVHPC_OFFLOAD=$NV_ARCH_CCXY"
274+
run_build $name "${NVHPC_NVCXX:?}" std "$cxx -DNVHPC_OFFLOAD=$NV_ARCH_CCXY -DSTDIMPL=DATA17"
275+
# Requires GCC 14
276+
# run_build $name "${NVHPC_NVCXX:?}" std "$cxx -DNVHPC_OFFLOAD=$NV_ARCH_CCXY -DSTDIMPL=DATA20"
277+
run_build $name "${NVHPC_NVCXX:?}" std "$cxx -DNVHPC_OFFLOAD=$NV_ARCH_CCXY -DSTDIMPL=INDICES"
275278

276279
run_build $name "${NVHPC_NVCXX:?}" acc "$cxx -DTARGET_DEVICE=gpu -DTARGET_PROCESSOR=px -DCUDA_ARCH=$NV_ARCH_CCXY"
277280
run_build $name "${NVHPC_NVCXX:?}" acc "$cxx -DTARGET_DEVICE=multicore -DTARGET_PROCESSOR=zen"

Diff for: src/dpl_shim.h

+3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ T *alloc_raw(size_t size) { return sycl::malloc_shared<T>(size, exe_policy.queue
2929
template<typename T>
3030
void dealloc_raw(T *ptr) { sycl::free(ptr, exe_policy.queue()); }
3131

32+
#define WORKAROUND
33+
3234
#else
3335

3436
// auto exe_policy = dpl::execution::seq;
3537
// auto exe_policy = dpl::execution::par;
3638
static constexpr auto exe_policy = dpl::execution::par_unseq;
3739
#define USE_STD_PTR_ALLOC_DEALLOC
40+
#define WORKAROUND
3841

3942
#endif
4043

Diff for: src/std-data/STDDataStream.cpp

-117
This file was deleted.

Diff for: src/std-indices/STDIndicesStream.cpp

-128
This file was deleted.

0 commit comments

Comments
 (0)