milupHPC documentation
  • src
device_rhs.cu
Go to the documentation of this file.
1#include "../include/device_rhs.cuh"
2#include "../include/cuda_utils/cuda_launcher.cuh"
3
4namespace Kernel {
5
6 __global__ void resetArrays(Tree *tree, Particles *particles, integer *mutex, integer n, integer m) {
7
8 integer bodyIndex = threadIdx.x + blockDim.x*blockIdx.x;
9 integer stride = blockDim.x*gridDim.x;
10 integer offset = 0;
11
12 while ((bodyIndex + offset) < m) {
13 tree->reset(bodyIndex + offset, n);
14
15 if ((bodyIndex + offset) >= n) {
16 particles->reset(bodyIndex + offset);
17 }
18
19 offset += stride;
20 }
21
22 if (bodyIndex == 0) {
23 *mutex = 0;
24 *tree->index = n;
25 *tree->minX = 0;
26 *tree->maxX = 0;
27#if DIM > 1
28 *tree->minY = 0;
29 *tree->maxY = 0;
30#if DIM == 3
31 *tree->minZ = 0;
32 *tree->maxZ = 0;
33#endif
34#endif
35 tree->toDeleteLeaf[0] = -1;
36 tree->toDeleteLeaf[1] = -1;
37 tree->toDeleteNode[0] = -1;
38 tree->toDeleteNode[1] = -1;
39
40 }
41 }
42
43 real Launch::resetArrays(Tree *tree, Particles *particles, integer *mutex, integer n, integer m, bool time) {
44 ExecutionPolicy executionPolicy;
45 return cuda::launch(time, executionPolicy, ::Kernel::resetArrays, tree, particles, mutex, n, m);
46 }
47
48}
49
ExecutionPolicy
Execution policy/instruction for CUDA kernel execution.
Definition: cuda_launcher.cuh:33
Particles
Particle(s) class based on SoA (Structur of Arrays).
Definition: particles.cuh:50
Particles::reset
CUDA_CALLABLE_MEMBER void reset(integer index)
Reset (specific) entries.
Definition: particles.cu:279
Tree
Tree class.
Definition: tree.cuh:140
Kernel::Launch::resetArrays
real resetArrays(Tree *tree, Particles *particles, integer *mutex, integer n, integer m, bool time=false)
Definition: device_rhs.cu:43
Kernel
Definition: device_rhs.cuh:7
Kernel::resetArrays
__global__ void resetArrays(Tree *tree, Particles *particles, integer *mutex, integer n, integer m)
Definition: device_rhs.cu:6
ProfilerIds::Time::tree
const char *const tree
Definition: h5profiler.h:57
cuda::launch
real launch(bool timeKernel, const ExecutionPolicy &policy, void(*f)(Arguments...), Arguments... args)
CUDA execution wrapper function.
Definition: cuda_launcher.cuh:114
real
double real
Definition: parameter.h:15
integer
int integer
Definition: parameter.h:17

milupHPC - src/device_rhs.cu Source File
Generated on Wed Aug 31 2022 12:16:52 by Doxygen 1.9.3