Hi,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 10, 2012 at 11:59 AM, Lee-Ping Wang <span dir="ltr">&lt;<a href="mailto:leeping@stanford.edu" target="_blank">leeping@stanford.edu</a>&gt;</span> wrote:<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 lang="EN-US" link="blue" vlink="purple"><div>
<p>On my local machine, I migrated my fluctuating charge code from Gromacs 4.0.7 to 4.5.5.  It took a bit of time, but I think the implementation is now a lot cleaner.  At some point, I would like to create a branch on the Gromacs repository,
 but first I need to solve a few issues with BLAS and LAPACK.  Basically, when I was originally writing the code I used the Intel headers and libraries, but now I want to convert this to something more compatible.</p></div>

</div></blockquote><div><br></div><div>If you want to submit this code at some time you will have to submit it against the master branch which is going to be 5.0. 5.0 is suppose to be partially migrated to C++. And I personally think that this should include a C++ vector/matrix interface. I started this discussion here: <a href="http://redmine.gromacs.org/issues/1017">http://redmine.gromacs.org/issues/1017</a>.  So the interface might be changed when this is decided. Feel free to comment on the issue.</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 lang="EN-US" link="blue" vlink="purple"><p><u></u></p>

<p><u></u></p>
<p><span style="font-family:&#39;Courier New&#39;">cblas_dgemm(101,111,111,N,N,N,1,VT,N,A1,N,0,Ai,N);<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">dgelss(&amp;N,&amp;N,&amp;nrhs,A1,&amp;N,x,&amp;N,S,&amp;rcond,&amp;rank,work,&amp;lwork,&amp;info);</span></p></div></blockquote><div>Is your code not accurately enough in single precision? Or could you benefit as the rest of Gromacs from using single precision (with the user having the choice to compile with GMX_DOUBLE)?</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 lang="EN-US" link="blue" vlink="purple"><div>
<p>However, when Gromacs calls its own BLAS and LAPACK functions it looks quite different:<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><span style="font-family:&#39;Courier New&#39;">#ifdef GMX_DOUBLE<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">    F77_FUNC(dsyevr,DSYEVR)(jobz,&quot;I&quot;,&quot;L&quot;,&amp;n,a,&amp;n,&amp;vl,&amp;vu,&amp;index_lower,&amp;index_upper,<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">                            &amp;abstol,&amp;m,eigenvalues,eigenvectors,&amp;n,<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">                            isuppz,&amp;w0,&amp;lwork,&amp;iw0,&amp;liwork,&amp;info);<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">#else<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">    F77_FUNC(ssyevr,SSYEVR)(jobz,&quot;I&quot;,&quot;L&quot;,&amp;n,a,&amp;n,&amp;vl,&amp;vu,&amp;index_lower,&amp;index_upper,<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">                            &amp;abstol,&amp;m,eigenvalues,eigenvectors,&amp;n,<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">                            isuppz,&amp;w0,&amp;lwork,&amp;iw0,&amp;liwork,&amp;info);<u></u><u></u></span></p>
<p><span style="font-family:&#39;Courier New&#39;">#endif</span></p></div></div></blockquote><div>I would write a macro (untested!)</div><div>#ifdef GMX_DOUblE<br>#define GMX_BLAS(A,B)  F77_FUNC(d ## A, D ## B)<br>#else<br>

#define GMX_BLAS(A,B)  F77_FUNC(s ## A, S ## B)<br>#endif<br></div><div><br></div><div>So that you can call it as </div><div><p><span style="font-family:&#39;Courier New&#39;">GMX_BLAS(syevr,SYEVR)(jobz,&quot;I&quot;,&quot;L&quot;,&amp;n,a,&amp;n,&amp;vl,&amp;vu,&amp;index_lower,&amp;index_upper,<u></u><u></u></span></p>

<p><span style="font-family:&#39;Courier New&#39;">                            &amp;abstol,&amp;m,eigenvalues,eigenvectors,&amp;n,<u></u><u></u></span></p><p><span style="font-family:&#39;Courier New&#39;">                            isuppz,&amp;w0,&amp;lwork,&amp;iw0,&amp;liwork,&amp;info);</span></p>

</div><div>without having to worry about the #ifdef GMX_DOUBLE at the callsite. Of course if you always want to use double you don&#39;t need to worry about it.</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 lang="EN-US" link="blue" vlink="purple"><div>
<p style="margin-left:36pt">
<u></u><span>2)<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&#39;Times New Roman&#39;">     
</span></span><u></u>How should I write my code so that a user can compile and link using Intel headers / libraries if they want to?  I imagine it’s related to the --use-external-blas and --use-external-lapack command line options to the configure script,
 but I don’t know how to use this.</p></div></div></blockquote><div>That should automatically work.</div><div><br></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 lang="EN-US" link="blue" vlink="purple"><div>
</div>
</div>

</blockquote></div>Roland<br><br clear="all"><div><br></div>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov">cmb.ornl.gov</a><br>865-241-1537, ORNL PO BOX 2008 MS6309<br>
</div>