Hello,
I am trying to find a solution to a reduction type problem. Unfortunately, it is different from the sample scenario, so I am at a loss for how to approach it. The problem can be summed up with this code:
for (unsigned int i = 0; i < INTERACTIONS; i++) {
sumforces[id[i].x] += force[i];
sumforces[id[i].y] -= force[i];
}
The code sums up accumulated forces for pairs of interacting particles (its for Smoothed Particle Hydrodynamics). There is one sumforces entry for each particle, and one force entry for each pair interaction, and id is the indicies of the two interacting particles.
Some specifics can be stated about the scenario:
-
The force is calculated on the GPU
-
There are approx 100K particles
-
There are approx 2-3 million interactions
-
force/sumforces is float4’s
-
id.x is contiguous (000112333)
-
id.y is all over the place
Is there some way to do this step on the GPU?
Thank You,
Cody