<div dir="ltr"><div>Jan,</div><div><br></div><div>If you want to profile and try to tune performance, I suggest you focus on the main simulation tool called &quot;mdrun&quot; and in particular its core functionalities as this is the tool that will be consuming the vast majority of compute cycles.<br></div><div><br></div><div>If you are using profiling tools to explore the code, find hot functions and such, I suggest that you grab one of the benchmark systems from here:</div><div><a href="http://ftp.gromacs.org/benchmarks/">http://ftp.gromacs.org/benchmarks/</a></div><div>and run one of those (make sure to pick a &quot;PME&quot; input if there are multiple).<br></div><div><br></div><div>And start by running those through a profiler ( e.g. run &quot;gmx mdrun -s topol.tpr -nsteps 1000&quot; for a 1000-iteration run). If you are proficient at profiling tools, you can also drop in manual annotation (or profiler start/stop) into out internal timer/profiler facilities (see  src/gromacs/timing/wallcycle.cpp).</div><div><br></div><div>Let us know if you have further questions.<br></div><div><br></div><div>Cheers,<br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">--<br>Szilárd</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 23, 2020 at 3:36 PM jan &lt;<a href="mailto:rtm443x@googlemail.com">rtm443x@googlemail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, see below<br>
<br>
On 23/03/2020, cblau &lt;<a href="mailto:cblau@gwdg.de" target="_blank">cblau@gwdg.de</a>&gt; wrote:<br>
<br>
[snip]<br>
&gt;<br>
&gt; As GROMACS is already highly specialised, it is a bit challenging to<br>
&gt; speed up quickly (though definitely possible to contribute in meaningful<br>
&gt; ways).<br>
<br>
My initial look is profile then see look at the most basic things such<br>
as memory hierarchy use. I mean, really basic stuff which you&#39;ll<br>
already have covered but at least it&#39;s a learning phase for me.<br>
<br>
&gt;<br>
&gt; With all urgency in mind, there is quite a time-delay in the way new<br>
&gt; code gets incorporated, because we do very much require scientific<br>
&gt; correctness and thorough code review to make sure that all simulation<br>
&gt; results are meaningful and we don&#39;t waste a ton of people efforts and<br>
&gt; compute power on a slight bug.<br>
<br>
Is good<br>
<br>
&gt;<br>
&gt; The largest speed up in a short time frame (the next months) is inmy<br>
&gt; option achieved by teaching people how to use GROMACS in the most<br>
&gt; efficient ways and make sure that people running simulations run them<br>
&gt; correctly.<br>
<br>
Knowing how to use a tool correctly is best way to get good results. I<br>
keep seeing the results where this does not happen. So I get you.<br>
I&#39;ll look on the site for reading material but any other pointers<br>
would help - but bear in mind I&#39;m very new to this, and numerical<br>
simulation isn&#39;t my thing so start simple!<br>
<br>
&gt;<br>
&gt; If you like, we can briefly chat tomorrow on how GROMACS is set up and<br>
&gt; the &quot;usual ways&quot; to contribute to GROMACS if you send me a personal email.<br>
&gt;<br>
<br>
Will do<br>
<br>
thanks<br>
<br>
jan<br>
<br>
<br>
&gt;<br>
&gt; Best,<br>
&gt; Christian<br>
&gt;<br>
&gt; On 2020-03-23 14:58, jan wrote:<br>
&gt;&gt; Hi,<br>
&gt;&gt; I&#39;m a general back-end dev.  Given the situation, and folding@home<br>
&gt;&gt; using gromacs, I thought I&#39;d poke through the code. I noticed<br>
&gt;&gt; something unexpected, and was advised to email it here. in edsam.cpp,<br>
&gt;&gt; this:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; void do_linacc(rvec* xcoll, t_edpar* edi)<br>
&gt;&gt; {<br>
&gt;&gt;      /* loop over linacc vectors */<br>
&gt;&gt;      for (int i = 0; i &lt; edi-&gt;vecs.linacc.neig; i++)<br>
&gt;&gt;      {<br>
&gt;&gt;          /* calculate the projection */<br>
&gt;&gt;          real proj = projectx(*edi, xcoll, edi-&gt;vecs.linacc.vec[i]);<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;          /* calculate the correction */<br>
&gt;&gt;          real preFactor = 0.0;<br>
&gt;&gt;          if (edi-&gt;vecs.linacc.stpsz[i] &gt; 0.0)<br>
&gt;&gt;          {<br>
&gt;&gt;              if ((proj - edi-&gt;vecs.linacc.refproj[i]) &lt; 0.0)<br>
&gt;&gt;              {<br>
&gt;&gt;                  preFactor = edi-&gt;vecs.linacc.refproj[i] - proj;<br>
&gt;&gt;              }<br>
&gt;&gt;          }<br>
&gt;&gt;          if (edi-&gt;vecs.linacc.stpsz[i] &lt; 0.0)<br>
&gt;&gt;          {<br>
&gt;&gt;              if ((proj - edi-&gt;vecs.linacc.refproj[i]) &gt; 0.0)<br>
&gt;&gt;              {<br>
&gt;&gt;                  preFactor = edi-&gt;vecs.linacc.refproj[i] - proj;<br>
&gt;&gt;              }<br>
&gt;&gt;          }<br>
&gt;&gt;         [...]<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; In both cases it reaches the same code<br>
&gt;&gt;<br>
&gt;&gt;    preFactor = edi-&gt;vecs.linacc.refproj[i] - proj<br>
&gt;&gt;<br>
&gt;&gt; That surprised me a bit, is it deliberate? If so it may be the code<br>
&gt;&gt; can be simplified anyway.<br>
&gt;&gt;<br>
&gt;&gt; That aside, if you&#39;re looking for performance I might be able to help.<br>
&gt;&gt; I don&#39;t know the high level stuff *at this point* and my C++ is so<br>
&gt;&gt; rusty it creaks, but I can brush that up, do profiling and whatnot.<br>
&gt;&gt; I&#39;m pretty experience, just not in this area.  Speeding things up is<br>
&gt;&gt; something I&#39;ve got a track record of (though I usually have a good<br>
&gt;&gt; feel for the problem domain first, which I don&#39;t here)<br>
&gt;&gt;<br>
&gt;&gt; Would it be of some value for me to try getting more speed? If so,<br>
&gt;&gt; first thing I&#39;d need is to get this running under cygwin, which I&#39;m<br>
&gt;&gt; struggling with.<br>
&gt;&gt;<br>
&gt;&gt; regards<br>
&gt;&gt;<br>
&gt;&gt; jan<br>
&gt;&gt;<br>
&gt; --<br>
&gt; Gromacs Developers mailing list<br>
&gt;<br>
&gt; * Please search the archive at<br>
&gt; <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before<br>
&gt; posting!<br>
&gt;<br>
&gt; * Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
&gt;<br>
&gt; * For (un)subscribe requests visit<br>
&gt; <a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or<br>
&gt; send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
&gt;<br>
-- <br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div>