diff --git a/examples/alpaka/nbody/nbody.cpp b/examples/alpaka/nbody/nbody.cpp index b90355d8db..6512a2051a 100644 --- a/examples/alpaka/nbody/nbody.cpp +++ b/examples/alpaka/nbody/nbody.cpp @@ -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;