Skip to content

Commit

Permalink
Support oneAPI SYCL
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Nov 20, 2023
1 parent c9968ea commit 60073f2
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions examples/alpaka/nbody/nbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ constexpr auto steps = 5; ///< number of steps to calculate
constexpr auto allowRsqrt = true; // rsqrt can be way faster, but less accurate
constexpr auto runUpate = true; // run update step. Useful to disable for benchmarking the move step.

#if defined(ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED) || defined(ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLED)
# if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED)
# error Cannot enable CUDA together with other backends
# endif
#if defined(ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED) || defined(ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLED) \
|| (defined(ALPAKA_ACC_SYCL_ENABLED) && defined(ALPAKA_SYCL_ONEAPI_CPU))
# define ANY_CPU_ENABLED 1
#endif
#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED) \
|| (defined(ALPAKA_ACC_SYCL_ENABLED) && defined(ALPAKA_SYCL_ONEAPI_GPU))
# define ANY_GPU_ENABLED 1
#endif

#if ANY_CPU_ENABLED && ANY_GPU_ENABLED
# error Cannot enable CPU and GPU backends at the same time
#endif

#if ANY_CPU_ENABLED
constexpr auto elementsPerThread = xsimd::batch<float>::size;
constexpr auto threadsPerBlock = 1;
constexpr auto sharedElementsPerBlock = 1;
constexpr auto aosoaLanes = xsimd::batch<float>::size; // vectors
#elif defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED)
#elif ANY_GPU_ENABLED
constexpr auto threadsPerBlock = 256;
constexpr auto sharedElementsPerBlock = 512;
constexpr auto elementsPerThread = 1;
Expand Down

0 comments on commit 60073f2

Please sign in to comment.