espressomd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo-devel] Porting Interaction Calculations to CUDA


From: Peter Toson
Subject: Re: [ESPResSo-devel] Porting Interaction Calculations to CUDA
Date: Sat, 05 May 2012 20:59:25 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1


Hi!

Thanks for pointing to on_integration_start(). It was indeed my idea
to collect the interaction data only once and store it in the constant
memory on the GPU.

What is the best way to clean up memory allocated in on_integration_start()?
Is there any event called after integration end or before ESPResSo shutdown?

-- Peter

Am 28.04.2012 21:08, schrieb Axel Arnold:
On Saturday 28 April 2012, Peter Toson wrote:
Yes, i ment the bonded interactions. Looks like I have to gather them
from the particles to transfer the bonded interactions to the GPU...
If you also use other interactions, you could collect them during the regular
bonded calculations, in add_bonded_force, forces.h. Or once in
on_integration_start() in initialize.c, which is called when you enter the
integration loop. After that, bonds only change if you use dynamic bonding. On
the other hand, it might be easier to collect the positions only for the
interaction every time step, and by that send them presorted to the GPU.

Many regards,
Axel

Thanks, Peter

Am 27.04.2012 19:51, schrieb Axel Arnold:
Sorry, but what do you mean by interactions? If you mean the bonded
interactions, they are indeed only stored with the particles, more
precisely, with one of the particles involved in the bond (so, for a
bond, only one partner knows about this bond!). There is no local or
global list of these, since we don't need it. We anyways loop the
particles once to calculate the nonbonded interactions, and during that
course, we also add the bonded interactions.

For the nonbonded short ranged interactions a local Verlet list is kept
with all the interacting pairs per pair of cells, but that does not
include the pairs you probably need.

Many regards,
Axel

On Friday 27 April 2012, Peter Toson wrote:
Hallo!

Thanks for the quick reply and pointing me to that code - you've saved
me a lot
of work.

Now I have a follow-up question: is there an array for all (local)
interactions as well?
Or can I get the interaction information only from particles?

-- Peter

Am 24.04.2012 16:38, schrieb Axel Arnold:
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]