[gmx-developers] Gromacs 3.2.1 PPC Altivec patch

Erik Lindahl lindahl at sbc.su.se
Fri Oct 8 19:55:08 CEST 2004


Hi Kyle,

Thanks a lot - I'll make sure to add this before we release 3.3.

I've recently found that some Apple versions of gcc have a bug when it 
comes to detecting Altivec support, and have worked around it in 
gromacs-3.2.2 and the upcoming 3.3 beta.

Cheers,

Erik

On Oct 8, 2004, at 7:31 PM, Kyle Ellrott wrote:

> The following is a patch that should allow gromacs-3.2.1 to compile 
> with altivec support on a Linux based PPC system.
> There are a couple difference between 'main-line' gcc and apple gcc.  
> First, altivec support is enabled with a '-maltivec' rather then a 
> '-faltivec'.  Next, you need to include a altivec.h header file (which 
> doesn't exist in current apple gcc), finally Some versions of mainline 
> gcc putz with the definition of bool (changes it to _bool) to get the 
> vector bool definition that's available in apple gcc.  This of course 
> conflicts with types/simple.h definition of bool.
>
> The following patch compiles successfully with gcc 3.4.2 and gcc from 
> MacOSX 10.3.  It fails to compile on standard Redhat AS 3 update 3 for 
> PPC (because of bug noted at 
> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=134368 )
>
> It has been tested on IBM JS20 (Redhat AS 3 update 3), and an Apple G5 
> with MacOSX 10.3.5.  It has only been tested for compilation and 
> runtime correctness.  I haven't tested scientific accuracy ;-)
>
>
> Kyle
>
>
>
> diff -r gromacs-3.2.1/acinclude.m4 gromacs-3.2.1.mine/acinclude.m4
> 805c805,806
> <  	        ACX_CHECK_CC_FLAGS(-faltivec,faltivec,xCFLAGS="$xCFLAGS 
> -faltivec"))
> ---
> >  	        ACX_CHECK_CC_FLAGS(-faltivec,faltivec,xCFLAGS="$xCFLAGS 
> -faltivec",
> >  	             
> ACX_CHECK_CC_FLAGS(-maltivec,maltivec,xCFLAGS="$xCFLAGS -maltivec",)))
> diff -r gromacs-3.2.1/configure.ac gromacs-3.2.1.mine/configure.ac
> 332c332
> < #ifndef __VEC__
> ---
> > #if !defined(__VEC__) || !defined(__ALTIVEC__)
> 339c339,347
> <       AC_MSG_RESULT([no])
> ---
> >     AC_TRY_COMPILE([#include <altivec.h>],[
> > #if !defined(__VEC__) || !defined(__ALTIVEC__)
> > choke_me
> > #endif
> > ],[
> >     AC_MSG_RESULT([yes])
> >     GMXLIB_LIBOBJS="${GMXLIB_LIBOBJS} inner_altivec.lo"
> >     AC_DEFINE([USE_PPC_ALTIVEC],,[Use PowerPC Altivec inner 
> loops])],[
> >      AC_MSG_RESULT([no])
> 343a352,353
> >      ]
> >    )
> diff -r gromacs-3.2.1/include/ppc_altivec.h 
> gromacs-3.2.1.mine/include/ppc_altivec.h
> 42a43,53
> > #if !defined(__APPLE_ALTIVEC__)
> > #if !defined(__ALTIVEC__) || !defined(__APPLE__)
> > #include <altivec.h>
> > #ifdef bool   //some versions of GCC putz with bool to be compatible 
> with the apple vector bool
> > #undef bool  //this of course conflicts with Gromac's definition in 
> types/simple.h
> > #define bool int
> > #endif
> > #endif
> > #endif
> >
> >
>
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.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