<div dir="ltr">Hi,<div><br></div><div>Just to follow up, I can explain the logic behind this:</div><div><br></div><div>It&#39;s not merely a matter of convenience (or history) for picking it at runtime, but simply that some algorithms will have different efficiencies depending on the vector length.</div><div><br></div><div>For instance, with a SIMD vector length of 4, it might work well to organize interactions into 4x4 tiles. Some of those interactions might fall outside the cutoff, but since the cluster is relatively small the wasted fraction is limited.</div><div>If the SIMD vector length is suddenly 16 instead, it would be trivial to just use exactly the same code, which would then mean the tiles are 16x16 interactions. However, with such gigantic clusters we would now waste a *much* larger fraction of the calculations.</div><div><br></div><div>Instead, we adapt to the SIMD with and use a different algorithm where we e.g. pack each 4x1 row into 25% of a longer SIMD register so we use the throughput of wider SIMD without wasting calculations due to more zero-interactions, but this can require us to use e.g. a different neighborlist generation setup.</div><div><br></div><div>Presently we detect this at compile time. It&#39;s theoretically possible to do at runtime instead, but a bit of work. However, there will always be algorithms where knowing the SIMD width in the hardware will enable you to write a more efficient implementation rather than keeping it opaque.</div><div><br></div><div>Cheers,</div><div><br></div><div>Erik</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 27, 2020 at 1:32 PM &lt;<a href="mailto:gilles@rist.or.jp">gilles@rist.or.jp</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Guido,<br>
<br>
Strictly speaking, SVE gives developers and compilers the opportunity to <br>
build/generate vector length agnostic (VLA) binaries/libraries<br>
whose performance almost as good as their fixed vector length <br>
counterpart. Such VLA programs can run (correctly) on any arm+sve <br>
processors,<br>
regardless the vector length that is available at runtime.<br>
<br>
Gromacs is highly optimized and assumes the vector length is known at <br>
cmake time, and this is assumed in several places of the code base.<br>
So the most straightforward and efficient way of supporting SVE is to <br>
fix the SVE vector length at cmake time.<br>
<br>
FWIW, I made a proof-of-concept of non bonded VLA kernels, and <br>
performance is not even close to current (fixed vector length)<br>
non bonded kernels.<br>
<br>
Cheers,<br>
<br>
Gilles<br>
<br>
----- Original Message -----<br>
&gt; Hi Gilles,<br>
&gt; <br>
&gt; Thanks a lot, I tested again and it is working with ArmIE for a length <br>
of 512. I will close the Issue in GitLab.<br>
&gt; <br>
&gt; SVE allows to set the vector length at run time, is there a particular <br>
reason for doing this at compile time?<br>
&gt; <br>
&gt; Cheers, Guido. <br>
&gt; <br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:gromacs.org_gmx-developers-bounces@maillist.sys.kth.se" target="_blank">gromacs.org_gmx-developers-bounces@maillist.sys.kth.se</a> [mailto:<br>
<a href="mailto:gromacs.org_gmx-developers-bounces@maillist.sys.kth.se" target="_blank">gromacs.org_gmx-developers-bounces@maillist.sys.kth.se</a>] On Behalf Of <br>
Gilles Gouaillardet<br>
&gt; Sent: Tuesday, October 27, 2020 10:05 AM<br>
&gt; To: <a href="mailto:gmx-developers@gromacs.org" target="_blank">gmx-developers@gromacs.org</a><br>
&gt; Subject: Re: [gmx-developers] Segfault in 2021-beta1 enabling SVE and <br>
ArmIE emulator<br>
&gt; <br>
&gt; Guido,<br>
&gt; <br>
&gt; <br>
&gt; The SVE vector length must be fixed at cmake time, and the default <br>
value is 512.<br>
&gt; <br>
&gt; In your case, you have to pass<br>
&gt; <br>
&gt; -DGMX_SIMD_ARM_SVE_LENGTH=256<br>
&gt; <br>
&gt; to your cmake command line.<br>
&gt; <br>
&gt; <br>
&gt; Cheers,<br>
&gt; <br>
&gt; <br>
&gt; Gilles<br>
&gt; <br>
&gt; On 10/27/2020 5:58 PM, Guido Giuntoli wrote:<br>
&gt; &gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; I have run the nonbonded-benchmark using the ArmIE emulator.<br>
&gt; &gt;<br>
&gt; &gt; I compiled gmx_d (DOUBLE FP) with GCC 10.2 for SVE by using:<br>
&gt; &gt;<br>
&gt; &gt; *CC=gcc-10 CXX=g++-10 \*<br>
&gt; &gt;<br>
&gt; &gt; *cmake .. \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DCMAKE_BUILD_TYPE=Release \*<br>
&gt; &gt;<br>
&gt; &gt; *-DCMAKE_C_FLAGS=&quot;-march=armv8-a+sve&quot; \*<br>
&gt; &gt;<br>
&gt; &gt; *-DCMAKE_CXX_FLAGS=&quot;-march=armv8-a+sve&quot; \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_MPI=off \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_GPU=off \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_USE_OPENCL=off \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_BUILD_MDRUN_ONLY=off \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_DOUBLE=on \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_SIMD=ARM_SVE \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DBUILD_SHARED_LIBS=off \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_FFT_LIBRARY=fftw3 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMX_INSTALL_NBLIB_API=OFF \*<br>
&gt; &gt;<br>
&gt; &gt; *        -DGMXAPI=OFF \*<br>
&gt; &gt;<br>
&gt; &gt; *        | tee cmake.log*<br>
&gt; &gt;<br>
&gt; &gt; I ran the benchmark with:<br>
&gt; &gt;<br>
&gt; &gt; *armie -msve-vector-bits=256 \*<br>
&gt; &gt;<br>
&gt; &gt; *        gmx_d nonbonded-benchmark \*<br>
&gt; &gt;<br>
&gt; &gt; *        -size 1 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -nt 1 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -simd 4xm \*<br>
&gt; &gt;<br>
&gt; &gt; *        -coulomb ewald \*<br>
&gt; &gt;<br>
&gt; &gt; *        -notable \*<br>
&gt; &gt;<br>
&gt; &gt; *        -combrule geometric \*<br>
&gt; &gt;<br>
&gt; &gt; *        -nohalflj \*<br>
&gt; &gt;<br>
&gt; &gt; *        -noenergy \*<br>
&gt; &gt;<br>
&gt; &gt; *        -noall \*<br>
&gt; &gt;<br>
&gt; &gt; *        -cutoff 1 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -iter 5 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -warmup 0 \*<br>
&gt; &gt;<br>
&gt; &gt; *        -nocycles*<br>
&gt; &gt;<br>
&gt; &gt; I get:<br>
&gt; &gt;<br>
&gt; &gt; *armie&#39;s SVESigHandler caught signal SIGSEGV from the process being <br>
&gt; &gt; emulated, passing it to the default signal handler.*<br>
&gt; &gt;<br>
&gt; &gt; *Guest process terminated by signal: 15152 Segmentation fault /home/.<br>
&gt; &gt; /codes/gromacs/gromacs-2021-beta1/build-sve/bin/gmx_d*<br>
&gt; &gt;<br>
&gt; &gt; According to the last meeting, I am eager to know if this branch has <br>
&gt; &gt; passed the regression tests using SVE. BTW, are you using SVE-<br>
enabled <br>
&gt; &gt; hardware or emulation for your development/tests?<br>
&gt; &gt;<br>
&gt; &gt; *Best regards | Mit freundlichen Grüßen*<br>
&gt; &gt;<br>
&gt; &gt; **<br>
&gt; &gt;<br>
&gt; &gt; *Guido Giuntoli***<br>
&gt; &gt;<br>
&gt; &gt; **<br>
&gt; &gt;<br>
&gt; &gt; HUAWEI TECHNOLOGIES Duesseldorf GmbH<br>
&gt; &gt; Hansaallee 205, 40549 Dusseldorf, Germany, *<a href="http://www.huawei.com" rel="noreferrer" target="_blank">www.huawei.com</a>* <br>
&gt; &gt; &lt;<a href="http://www.huawei.com/" rel="noreferrer" target="_blank">http://www.huawei.com/</a>&gt; Registered Office: Düsseldorf, Register <br>
Court <br>
&gt; &gt; Düsseldorf, HRB 56063, Managing Director: Li Peng, Li Jian, Shi <br>
&gt; &gt; Yanli**<br>
&gt; &gt;<br>
&gt; &gt; Sitz der Gesellschaft: Düsseldorf, Amtsgericht Düsseldorf, HRB 56063,<br>
&gt; &gt; Geschäftsführer: Li Peng, Li Jian, Shi Yanli<br>
&gt; &gt;<br>
&gt; &gt; *-------------------------------------------------------------------<br>
--<br>
&gt; &gt; --------------------------*<br>
&gt; &gt;<br>
&gt; &gt; *This e-mail and its attachments contain confidential information <br>
from <br>
&gt; &gt; HUAWEI, which is intended only for the person or entity whose <br>
address <br>
&gt; &gt; is listed above. Any use of the information contained herein in any <br>
&gt; &gt; way (including, but not limited to, total or partial disclosure, <br>
&gt; &gt; reproduction, or dissemination) by persons other than the intended<br>
&gt; &gt; recipient(s) is prohibited. If you receive this e-mail in error, <br>
&gt; &gt; please notify the sender by phone or email immediately and delete <br>
&gt; &gt; it!***<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; --<br>
&gt; Gromacs Developers mailing list<br>
&gt; <br>
&gt; * 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><br>
 before 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><br>
 or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
&gt; -- <br>
&gt; Gromacs Developers mailing list<br>
&gt; <br>
&gt; * 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><br>
 before 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><br>
 or 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><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Erik Lindahl &lt;<a href="mailto:erik.lindahl@dbb.su.se" target="_blank">erik.lindahl@dbb.su.se</a>&gt;</div><div>Professor of Biophysics, Dept. Biochemistry &amp; Biophysics, Stockholm University</div><div>Science for Life Laboratory, Box 1031, 17121 Solna, Sweden</div></div></div></div></div></div></div></div></div>