Hi!
If I didn't missunderstand you, you basically want to do the same as the LB-
GPU code. That code also copies the positions and velocities to the GPU and
gets the forces back. The interesting parts for you are lbgpu_cfile.c,
lb_calc_particle_lattice_ia_gpu and lb_send_forces_gpu. These also handle the
gathering of the parallely distributed particle data.
There are some minor issues with the C++/C interfacing since CUDA is
inherently C++, but that can be solved using "extern "C" {}" constructs. In
any case, you don't need to recompile the whole code, just your GPU code and
of course linking.
Axel
On Tuesday 24 April 2012, Toson Peter wrote:
Hallo!
I am trying to port the force calculation of some self-implemented
bonded interactions to CUDA. For a beginning, I would like to write
isolated tests (for performance and correctness) comparing
the CPU and GPU calculations.
The tests should look something like this:
================================================================
build Particles
build Interactions
for each Particle P {
for each Interaction I of P {
add force cause by I to P
}
}
convert Particle and Interaction data to a GPU-friendly format
do force calculation on GPU
compare results and times
================================================================
What would be the best way to do it, without compiling whole ESPResSo
after any change to the GPU-Implementation?
"Only" using the Particle and Interaction structs from ESPResSo? Is
that even possible considering the many includes in particle_data.h/c?
Implementing fake Particle and Interaction structs containing only the
members needed for the force calculation?
Some other way I did not think of?
--
Peter Toson
Industrial Simulation
St. Poelten University of Applied Sciences