aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting/SortingUtils.H
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-09-25 14:53:21 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-10-01 16:32:38 -0700
commitfeac8d56e5cc84f63f6e7be7e1668113558c9e47 (patch)
tree22535973a3daf9df09ccbc68adc17f3e7504d979 /Source/Particles/Sorting/SortingUtils.H
parenta7d4ebb9cb2b7528b7b1891eccb794fb6b70cf09 (diff)
downloadWarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.tar.gz
WarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.tar.zst
WarpX-feac8d56e5cc84f63f6e7be7e1668113558c9e47.zip
Implement `iota` on GPU
Diffstat (limited to 'Source/Particles/Sorting/SortingUtils.H')
-rw-r--r--Source/Particles/Sorting/SortingUtils.H18
1 files changed, 18 insertions, 0 deletions
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 <AMReX_Gpu.H>
+#include <AMReX_CudaContainers.H>
+
+// TODO: Add documentation
+void fillWithConsecutiveIntegers( amrex::Gpu::ManagedDeviceVector<long>& 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_