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: Axel Arnold
Subject: Re: [ESPResSo-devel] Porting Interaction Calculations to CUDA
Date: Sat, 5 May 2012 22:51:28 +0200
User-agent: KMail/1.13.6 (Linux/2.6.38-14-generic; KDE/4.6.5; x86_64; ; )

On Saturday 05 May 2012, Peter Toson wrote:
> 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?

Hi!

There is nothing that is called at the of integration, simply because in 
general that might be just before the next integration start. Therefore, we 
never deallocate there, but simply, if necessary, reallocate on integration 
start. There was for long a routine on_program_end, but since never anyone 
freed something there, we dropped that - the memory is anyways freed when the 
program terminates.

Axel

> 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


-- 
JP Dr. Axel Arnold      Tel: +49 711 685 67609
ICP, Universität Stuttgart      Email: address@hidden
Pfaffenwaldring 27
70569 Stuttgart, Germany



reply via email to

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