<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 11, 2014 at 5:01 PM, Erik Lindahl <span dir="ltr">&lt;<a href="mailto:erik.lindahl@scilifelab.se" target="_blank">erik.lindahl@scilifelab.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div class="im"><div>
<br><div><div>On 11 Jan 2014, at 15:45, David van der Spoel &lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt; wrote:</div><blockquote type="cite"><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>For the future we should become even more stringent on new code. I<span> </span><br>propose to also prevent new C code from going into the mdrun part of the<span> </span><br>code, at least past release of 5.0. Only by forcing all developers to<span> </span><br>
make the switch can we get a broader developer base for future coding.<br></div></blockquote><br></div></div></div><div>When it comes to new modules I fully agree. We should also get better at replacing old modules (well, starting with modularizing stuff), but I think it’s better to keep _old_ code and patches to it C so we properly clean up and modularize as we advance, rather than having a gigantic unstructured mix of C and C++ code in all files.</div>
</div></blockquote><div><br></div><div>Depending what you mean by &quot;old code&quot;, that may not be workable. Anywhere we want to use task parallelism is going to have to be compiled as C++, e.g. because TBB requires it. The tasks themselves can be calling &quot;old C&quot; code (e.g. actual kernels), of course. I think that anywhere we use OpenMP has already volunteered for being compiled as C++ in the near future, because it&#39;s the performance-critical code we need to work on. PME and NBNXN stuff that is not actually a kernel, I&#39;m looking at you!</div>
<div><br></div><div>&quot;Old code&quot; such as things we don&#39;t care about or plan to throw out at some point seems likely to stay C until someone cares / it dies. Group kernels, I&#39;m looking at you! :-)</div><div>
<br></div><div>I do like David&#39;s suggestion to require some language-level discipline about future changes to mdrun. Making that a workable policy requires that a whole lot more code compiles as C++, which was anyway on my &quot;to do right after 5.0 releases&quot; list. I want to move away from content like do_md() being littered with C and preprocessor conditionality. We have the ongoing need to implement algorithms in the face of huge configure- and run-time flexibility, which is a natural fit for the Strategy design pattern. (In September, I had plans to get started on this, which I deferred for some hoped-for changes from Michael, which unfortunately didn&#39;t happen.) That all combines naturally.</div>
<div><br></div><div>Of course, an mdrun bug fix should generally be a stylistic match with the code that&#39;s around it.</div><div><br></div><div>There will be problems when (for example) people like Christian, Magnus or  Carsten comes along with an otherwise useful, well-written and workable feature like LJPME/TNG support/CompEl in gerrit recently/right now, but which is not C++, perhaps with new data structures that do not even follow C-style <a href="http://www.gromacs.org/Developer_Zone/Programming_Guide/Encapsulation">http://www.gromacs.org/Developer_Zone/Programming_Guide/Encapsulation</a>, etc. If the code with which it might work can call C++, then we&#39;d have to take the hard line, no matter how much we like our friends ;-) If it can&#39;t call C++, then probably it&#39;s a signal that it should get worked on... but right now it seems there are too few hands to the wheel for all the unglamorous heavy lifting that will need doing. I can live with that, but it will mean a period of time of unknown length where someone with limited C++ background and/or not in Stockholm will basically have no chance of getting anything accepted in GROMACS. I&#39;d certainly like a month or so to actually convert some existing code as examples, before we might really adopt such a policy. We all need to learn a bit more, here.</div>
<div><br></div><div>So, to answer Roland&#39;s original question, STL vectors for NBNXN cluster index lists seem like a good first step. The arrays get used in the kernel functions, but the lengths are not, so passing in &amp;vector[0] will be fine, because of the std::vector guarantee of contiguity and the lack of need for SIMD alignment. This would lead to bad performance only on an architecture where the C++ compiler cannot do as good a job as the C compiler, even for such a simple case. We have already accepted that this kind of thing could happen sometime somewhere. We are not going to shed tears over it. We&#39;ll only shed blood fixing it if it&#39;s g++ on x86, too ;-)</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Mark</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>Cheers,</div><div><br></div><div>Erik</div></div><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" 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" 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" 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">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div><br></div></div>