[gmx-developers] single precision, double precision hybrid GROMACS

Erik Lindahl lindahl at sbc.su.se
Mon Apr 10 00:10:24 CEST 2006


Hi Dan,

On Apr 7, 2006, at 9:28 PM, D. Ensign wrote:

> says Eric Lindahl:
>> I think the only case for "limited double precision" is to get
>> perfect energy conservation with constraints.
>
> Hold on, let's stop right there for a minute. Not that this train  
> has already passed by.
>
> Allow me to re-muddy the waters after Michael's clarification.  
> Please don't let it matter
> to you WHY I want to do certain things in double precision and  
> others in single --
> although it's not a big mystery, perhaps we can all pretend that  
> I'm doing it because of
> the voices in my head, and what's a better reason than that?  
> Besides, someday I'm sure
> I'll see you guys at a meeting, and I'll be jabbering on about what  
> a great idea it was
> to do some calculations in single prec. and others in double. Then  
> you'll all make fun of
> me and poke me with sharp sticks, until I start crying and run away  
> to hide in the
> cupboard. I will not be coaxed out except with Gouda, Dutch beer,  
> and gentle coos of
> "That's a nice little monkey, that's a boy." All in good time, my  
> friends, all in good
> time.

Well, to us the reason _is_ important, since it has do with where we  
(possibly) lose accuracy, and we want to isolate those places as much  
as possible and fix the actual error.

Single precision will likely become even more important in the future  
as we move to graphics cards, physics coprocessors, embedded systems,  
etc., and for many of these it's simply not possible to use double -  
we have to work around precision loss in other ways (summation order,  
etc.).

In other words, there might be more people interested in helping if  
you choose that path :-)


>
> That being said, what would be easier to appease the voices:
> 1. Use the single precision code and make the constraints double
> 2. Use the double precision code and make the forces single (the  
> force calculations look
> like they're all OVER the place, but I bet I can track them all down)

For both of these you'll need to convert coordinate, force, and  
energy arrays between double and single every time you call the  
routine in the alternative precision.  Just doing the constraints  
(not integration) in double probably won't suffice to conserve  
energy, though.

> 3. Compile single precision and double precision libraries, then  
> link, eg, single
> precision fnbf.o with, eg, double precision md.o
>
Not possible. You can't provide a single precision array in a  
function call to a routine expecting a double precision one.


Cheers,

Erik





More information about the gromacs.org_gmx-developers mailing list