<div dir="ltr">I downloaded the proposed change, and everything compiled wonderfully. Thank you so much for the change!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 23, 2019 at 4:39 PM Mark Abraham &lt;<a href="mailto:mark.j.abraham@gmail.com">mark.j.abraham@gmail.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"><div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 23 Jul 2019 at 20:47, Adriaan Riet &lt;<a href="mailto:aar93@case.edu" target="_blank">aar93@case.edu</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"><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail-m_-6142272941139485343gmail-m_5974359332687495335gmail_signature"><div dir="ltr"><div><br></div>Adriaan Riet<div>801-602-0172</div><div><a href="mailto:adriaan.riet@case.edu" target="_blank">adriaan.riet@case.edu</a></div></div></div></div><div dir="ltr">Hello,<div><br></div><div>I have been working on building gromacs with GMX_GPU=ON in MSVC 2019 (and cuda 10.1)  I&#39;ve used the Ninja and Visual studio 2019 Win64 generators, and I&#39;m using the x64 cl.exe as the host compiler, cxx compiler, etc. </div></div></div></blockquote><div><br></div><div>Great. We haven&#39;t prioritized trying to make such a setup work, as it&#39;s not commonly used for computation, and we don&#39;t have a machine with the MS compiler and a NVIDA GPU. But perhaps we can get things in order with your help :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>With GMX_GPU=OFF, I only needed to make sure there were no spaces in some of the cmake flags (I changed CUDA_TOOLKIT_ROOT_DIR, MKL_LIBRARIES, MKL_INCLUDE_DIR), and everything builds and runs fine.</div><div><br></div><div>With GMX_GPU=ON, I&#39;ve seen a couple of issues. First, and I&#39;ve gotten around this by changing CUDA_HOST_COMPILER, the location ${VCInstallDir}bin no longer points to a valid compiler. MS has opted to change the location and provide separate x86 and x64 compilers and cross compilers. I&#39;ve pointed the CUDA_HOST_COMPILER variable to the same compiler as the other CMAKE_C**_COMPILER variables, </div><div>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\Hostx64\x64\cl.exe<br></div><div>I&#39;m not sure that this is the compiler I should be using, as GPU should be single precision, but I wanted to be consistent.</div></div></div></blockquote><div><br></div><div>That looks fine.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>I&#39;m running into an issue in the CUDA code. Specifically, there are a few lines in <a href="http://nbnxm_cuda.cu/" target="_blank">nbnxm_cuda.cu</a> that set up for launching the kernel (lines 834, 879, etc):<br></div><div><br></div><div>const auto kernelArgs          = prepareGpuKernelArguments(kernelFn, config,<br>                                                               &amp;numColumns,<br>                                                               &amp;xqPtr,<br>                                                               &amp;setFillerCoords,<br>                                                               &amp;d_x,<br>                                                               &amp;d_atomIndices,<br>                                                               &amp;d_cxy_na,<br>                                                               &amp;d_cxy_ind,<br>                                                               &amp;cellOffset,<br>                                                               &amp;numAtomsPerCell);<br>    launchGpuKernel(kernelFn, config, nullptr, &quot;XbufferOps&quot;, kernelArgs);<br></div><div><br></div><div>the relevant template generating prepareGpuKernelArguments is (I think, from cudautils.cuh):</div><div><br></div><div>template &lt;typename ... Args&gt;<br>std::array&lt;void *, sizeof ... (Args)&gt; prepareGpuKernelArguments(void                     (*kernel)(Args...),<br>                                                                const KernelLaunchConfig &amp; /*config */,<br>                                                                const Args *...          argsPtrs)<br>{<br>    std::array&lt;void *, sizeof ... (Args)&gt; kernelArgs;<br>    prepareGpuKernelArgument(kernel, &amp;kernelArgs, 0, argsPtrs ...);<br>    return kernelArgs;<br>}<br></div><div><br></div><div>the compiler throws a fit with this, stating that (I&#39;ve changed the order to what I understand to be cause/effect):</div><div><br></div><div>1. &quot;Error        C2782        &#39;std::array&lt;void*,sizeof...(Args)&gt; prepareGpuKernelArguments(void (__cdecl *)(Args...),const KernelLaunchConfig &amp;,const Args *...)&#39;: template parameter &#39;Args&#39; is ambiguous &quot;</div><div>2. &quot; &#39;prepareGpuKernelArguments&#39;: no matching overloaded function found</div><div>3. &quot; &#39;kernelArgs&#39;: cannot be used before it is initialized</div><div>4. &quot; &#39;kernelArgs&#39;: an object of const-qualified type must be initialized</div><div>5. &quot; &#39;void launchGpuKernel&lt;const float3*__restrict ,rvec(*),const int*__restrict ,int,int&gt;(void (__cdecl *)(const float3 *__restrict ,rvec (*),const int *__restrict ,int,int),const KernelLaunchConfig &amp;,CommandEvent *,const char *,const std::array&lt;void *,5&gt; &amp;)&#39;: cannot convert argument 5 from &#39;int&#39; to &#39;const std::array&lt;void *,5&gt; &amp;&#39; <a href="http://nbnxm_cuda.cu/" target="_blank">nbnxm_cuda.cu</a>        886 </div><div><br></div><div>Seems to me that VS isn&#39;t recognizing some feature here. Is this something that might be easy to fix?</div></div></div></blockquote><div><br></div><div>Googling around, it seems that MSVC does struggle more with variadic templates than the other major compilers. I experimented a bit with Compiler Explorer, and I think the problem arises because the three kinds of arguments to prepareGpuKernelArguments aren&#39;t clear enough to the compiler. If so, then I think the proposed change at <a href="https://gerrit.gromacs.org/c/gromacs/+/12183" target="_blank">https://gerrit.gromacs.org/c/gromacs/+/12183</a> will fix it. Other compilers still seem to be happy, and it can&#39;t affect the quality of the generated code (touch wood). If you&#39;re able to use the download link there, you can get a tarball of source code that you can build in the same way you have done with the official tarball so far, and let us know how you get on. (By the way, 2019 has had several patch-level releases so far, which you&#39;d probably want to take advantage of...)</div><div><br></div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Thanks,</div><div>Adriaan Riet</div></div></div>
-- <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>.</blockquote></div></div>
-- <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>.</blockquote></div>