From feac8d56e5cc84f63f6e7be7e1668113558c9e47 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Wed, 25 Sep 2019 14:53:21 -0700 Subject: Implement `iota` on GPU --- Source/Particles/Sorting/SortingUtils.H | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Source/Particles/Sorting/SortingUtils.H (limited to 'Source/Particles/Sorting/SortingUtils.H') diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H new file mode 100644 index 000000000..d072ebd2a --- /dev/null +++ b/Source/Particles/Sorting/SortingUtils.H @@ -0,0 +1,18 @@ +#ifndef WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ +#define WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ + +#include +#include + +// TODO: Add documentation +void fillWithConsecutiveIntegers( amrex::Gpu::ManagedDeviceVector& v ) { +#ifdef AMREX_USE_GPU + // On GPU: Use thrust + thrust::sequence( v.begin(), v.end() ); +#else + // On CPU: Use std library + std::iota( v.begin(), v.end(), 0L ); +#endif +} + +#endif // WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ -- cgit v1.2.3