[gmx-developers] slightly odd-looking code

cblau cblau at gwdg.de
Mon Mar 23 15:19:20 CET 2020

Hi Jan,

Thanks for reaching out!

The part of code that you quote is part of the essential dynamics module 
that is a quite specialised algorithm and - as I would guess - not used 
in folding at home.

As GROMACS is already highly specialised, it is a bit challenging to 
speed up quickly (though definitely possible to contribute in meaningful 

With all urgency in mind, there is quite a time-delay in the way new 
code gets incorporated, because we do very much require scientific 
correctness and thorough code review to make sure that all simulation 
results are meaningful and we don't waste a ton of people efforts and 
compute power on a slight bug.

The largest speed up in a short time frame (the next months) is inmy 
option achieved by teaching people how to use GROMACS in the most 
efficient ways and make sure that people running simulations run them 

If you like, we can briefly chat tomorrow on how GROMACS is set up and 
the "usual ways" to contribute to GROMACS if you send me a personal email.


On 2020-03-23 14:58, jan wrote:
> Hi,
> I'm a general back-end dev.  Given the situation, and folding at home
> using gromacs, I thought I'd poke through the code. I noticed
> something unexpected, and was advised to email it here. in edsam.cpp,
> this:
> void do_linacc(rvec* xcoll, t_edpar* edi)
> {
>      /* loop over linacc vectors */
>      for (int i = 0; i < edi->vecs.linacc.neig; i++)
>      {
>          /* calculate the projection */
>          real proj = projectx(*edi, xcoll, edi->vecs.linacc.vec[i]);
>          /* calculate the correction */
>          real preFactor = 0.0;
>          if (edi->vecs.linacc.stpsz[i] > 0.0)
>          {
>              if ((proj - edi->vecs.linacc.refproj[i]) < 0.0)
>              {
>                  preFactor = edi->vecs.linacc.refproj[i] - proj;
>              }
>          }
>          if (edi->vecs.linacc.stpsz[i] < 0.0)
>          {
>              if ((proj - edi->vecs.linacc.refproj[i]) > 0.0)
>              {
>                  preFactor = edi->vecs.linacc.refproj[i] - proj;
>              }
>          }
>         [...]
> In both cases it reaches the same code
>    preFactor = edi->vecs.linacc.refproj[i] - proj
> That surprised me a bit, is it deliberate? If so it may be the code
> can be simplified anyway.
> That aside, if you're looking for performance I might be able to help.
> I don't know the high level stuff *at this point* and my C++ is so
> rusty it creaks, but I can brush that up, do profiling and whatnot.
> I'm pretty experience, just not in this area.  Speeding things up is
> something I've got a track record of (though I usually have a good
> feel for the problem domain first, which I don't here)
> Would it be of some value for me to try getting more speed? If so,
> first thing I'd need is to get this running under cygwin, which I'm
> struggling with.
> regards
> jan

More information about the gromacs.org_gmx-developers mailing list