[gmx-developers] #ifdef statement to test for Apple compiler

Erik Lindahl erik at kth.se
Thu Jul 12 15:28:20 CEST 2012


Hi Jochen,

I think the speed difference comes from your compiler using the x87 (old-style) floating point instructions instead of new SSE-based ones.

The i387 FP instructions actually have specific sin/cos functions that are much faster than SSE, and if you only compute single values (without having the rest of your code in SSE) that is definitely faster. However, both Intel and AMD are gradually deprecating x87 FP co-processor instruction support, so in the future that won't work.

The obvious way to test whether this is the case or not is to use the intel compiler and their implementations of mm_sincos_ps().

Cheers,

Erik


On Jul 12, 2012, at 1:54 PM, Jochen Hub wrote:

> Hi,
> 
> oh sorry, answer was too short. I have the
> 
> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
> 
> Does this answer your question?
> 
> Thank,
> Jochen
> 
> 
> 
> Am 7/12/12 12:53 PM, schrieb Szilárd Páll:
>> Hi,
>> 
>> Which compiler are you referring to, gcc-llvm? Which version? Which
>> code-base are you compiling?
>> 
>> Normally, when it comes to such optimizations it's the compiler that
>> matters, not so much the OS itself (except on Win).
>> 
>> --
>> Szilárd
>> 
>> 
>> On Thu, Jul 12, 2012 at 9:24 AM, Jochen Hub <jhub at gwdg.de
>> <mailto:jhub at gwdg.de>> wrote:
>> 
>>    Hi,
>> 
>>    is there a constant defined in the code that allows to test if
>>    gromacs is compiled with an Apple compiler?
>> 
>>    I ask since I need to compute many sine's and cosines, and the
>>    SSE2-using function gmx_mm_sincos_ps is slower on a Mac than a
>>    simple sinf/cosf behind each other. I assume that the Mac uses its
>>    optimized vsincosf function, that's why its faster than the
>>    SSE2-using function. So want to use sinf/cosf on the apple, but
>>    gmx_mm_sincos_ps anywhere else (as long as SSE2 is present). Any
>>    idea how to check this?
>> 
>>    Many thanks,
>>    Jochen
>> 
>> 
>> 
>> 
>> 
>>    --
>>    ------------------------------__---------------------
>>    Dr. Jochen Hub
>>    Computational Molecular Biophysics Group
>>    Institute for Microbiology and Genetics
>>    Georg-August-University of Göttingen
>>    Justus-von-Liebig-Weg 11, 37077 Göttingen, Germany.
>>    Phone: +49-551-39-14189 <tel:%2B49-551-39-14189>
>>    http://cmb.bio.uni-goettingen.__de/ <http://cmb.bio.uni-goettingen.de/>
>>    ------------------------------__---------------------
>> 
>>    --
>>    gmx-developers mailing list
>>    gmx-developers at gromacs.org <mailto:gmx-developers at gromacs.org>
>>    http://lists.gromacs.org/__mailman/listinfo/gmx-__developers
>>    <http://lists.gromacs.org/mailman/listinfo/gmx-developers>
>>    Please don't post (un)subscribe requests to the list. Use the www
>>    interface or send it to gmx-developers-request at __gromacs.org
>>    <mailto:gmx-developers-request at gromacs.org>.
>> 
>> 
>> 
>> 
> 
> -- 
> ---------------------------------------------------
> Dr. Jochen Hub
> Computational Molecular Biophysics Group
> Institute for Microbiology and Genetics
> Georg-August-University of Göttingen
> Justus-von-Liebig-Weg 11, 37077 Göttingen, Germany.
> Phone: +49-551-39-14189
> http://cmb.bio.uni-goettingen.de/
> ---------------------------------------------------
> 
> 
> -- 
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the www interface or send it to gmx-developers-request at gromacs.org.
> 




More information about the gromacs.org_gmx-developers mailing list