[gmx-users] gromacs invsqrt() overlaps with icc invsqrt()

Mark Abraham Mark.Abraham at anu.edu.au
Tue Jun 2 17:11:32 CEST 2009


chris.neale at utoronto.ca wrote:
> Hello,
> 
> I have just compiled gromacs 4.0.4 using the intel compiler. While I 
> believe that gromacs itself doesn't get a huge benefit from icc, fftw 
> certainly does and it's on the order of a 10% speedup, which is 
> significant enough for me to dedicate some time to getting this working.
> 
> Problem is, invsqrt is defined both in gromacs and in the icc libraries, 
> as is already known:
> http://www.gromacs.org/pipermail/gmx-users/2006-June/022009.html
> 
> ../../../include/vec.h(152): warning #147: declaration is incompatible 
> with "double invsqrt(double)" (declared at line 635 of 
> "/opt/sharcnet/intel/11.0.083/icc/include/math.h")
>   static inline real invsqrt(real x)
> 
> I have solved this problem by the following procedure:
> 
> #########################
> #!/bin/bash
> for i in `find ./gromacs-4.0.4`; do
>   sed 's/invsqrt/invSAFEsqrt/g' "$i" > tmp;
>   mv tmp "$i";
> done
> chmod +x ./gromacs-4.0.4/configure

Using sed -i is a bit more elegant and keeps the permissions, IIRC.

> mv ./gromacs-4.0.4/src/gmxlib/cinvsqrtdata.c 
> ./gromacs-4.0.4/src/gmxlib/cinvSAFEsqrtdata.c
> #########################
> 
> And it now compiles without warning.
> 
> I was unable to link an icc-compiled fftw to a PGI or gcc compilation of 
> gromacs, due to linking problems, although I imagine that that is possible.
> 
> First, does anybody see any immediate problems with this?

Looks OK.

> Second, is there still a motivation to get rid of this problem?

It seems reasonable to get the GROMACS function out of the standard 
namespace, or to test for and use a library function with configure.

> Third, does anybody know how I can link an icc-compiled fftw to a PGI or 
> gcc compilation of gromacs, and if there is any reason that this is a 
> bad idea?

I would have expected it to just work, however I have had multiple 
inexplicable problems with various icc versions on IA64 hardware.

Mark



More information about the gromacs.org_gmx-users mailing list