On Fri, Dec 28, 2012 at 09:17:09AM -0700, Alexander Hansen wrote:
> On 12/27/12 2:09 PM, Jack Howarth wrote:
> > Andrew,
> >    Attached is alternative afni packaging for the 10.7 tree that disables 
> > the use
> > of omp (since this hasn't been implemented for clang yet) and fixes the
> > remaining language compatibility issues that causes clang errors. These 
> > are...
> > 
> > --- AFNI_2010_10_19_1028/mri_warp.c.orig    2012-12-27 15:25:38.000000000 
> > -0500
> > +++ AFNI_2010_10_19_1028/mri_warp.c 2012-12-27 15:32:03.000000000 -0500
> > @@ -23,7 +23,7 @@
> >  
> >  static float sx_scale , sy_scale ;  /* global scaler data */
> >  
> > -INLINE void xxMRI_scaler( float xpr, float ypr, float *xx , float *yy )
> > +static inline void xxMRI_scaler( float xpr, float ypr, float *xx , float 
> > *yy )
> >  {
> >     *xx = sx_scale * xpr ;
> >     *yy = sy_scale * ypr ;
> > @@ -338,7 +338,7 @@
> >  
> >  static float rot_dx , rot_dy , rot_cph , rot_sph ;    /* global rotfunc 
> > data */
> >  
> > -INLINE void xxMRI_rotfunc( float xpr , float ypr , float *xx , float *yy )
> > +static inline void xxMRI_rotfunc( float xpr , float ypr , float *xx , 
> > float *yy )
> >  {
> >     *xx =  rot_cph * xpr + rot_sph * ypr + rot_dx ;
> >     *yy = -rot_sph * xpr + rot_cph * ypr + rot_dy ;
> > --- AFNI_2010_10_19_1028/svm/3dsvm_common.c.orig    2012-12-27 
> > 15:48:28.000000000 -0500
> > +++ AFNI_2010_10_19_1028/svm/3dsvm_common.c 2012-12-27 15:49:46.000000000 
> > -0500
> > @@ -1566,7 +1566,7 @@
> >            kernelName);
> >      }
> >  
> > -    EXRETURN;
> > +    RETURN(0);
> >    }
> >  
> >    /* --- allocate memory ---*/
> > @@ -1577,7 +1577,7 @@
> >    Clear2c(maps->names, maps->nmaps);
> >    Clear2d(maps->data, maps->nmaps, maps->nvox);
> >  
> > -  EXRETURN;
> > +  RETURN(0);
> >  }
> >  
> >  freeModelMaps(MODEL_MAPS *maps) 
> > @@ -1587,7 +1587,7 @@
> >    free2d(maps->data, maps->nmaps);
> >    free2c(maps->names, maps->nmaps);
> >    
> > -  EXRETURN;
> > +  RETURN(0);
> >  }
> >  
> >  void addToModelMap_bucket ( MODEL_MAPS *maps, AFNI_MODEL *afni_model,
> > 
> > The first is http://clang.llvm.org/compatibility.html#inline for C99 inline
> > functions causing undefined symbols on linkage and is fixed as recommended 
> > by
> > making these static. The second is the usage of the wrong return macro in
> > 3dsvm_common.c. The attached packaging builds fine with 'fink -m' on 
> > x86_64-apple-darwin12
> > under Xcode 4.5.2.
> >           Jack
> > 
> > 
> > 
> 
> Out of curiosity, is there a noticeable performance hit in not using omp?

Alexander,
   I haven't done any benchmarking yet, but if I were going to rely on omp
support I definitely would use gcc47-compiler instead of llvm-gcc. The omp
support is almost six years newer and with known regression testresults
(unlike Apple llvm-gcc's where you have to assume that has no regressions
in the libgomp testsuite).
   A more interesting approach would be to tweak up compilation flags used
for clang to obtain enhanced performance (especially since clang won't suffer
from any codegen issues in FSF gcc that might have required the use of -O2).
         Jack
ps FYI, using the clang from llvm32 would likely provide significant speed
improvement as Apple is conservative with the rate of adoption for newer 
optimizations in the compiler compared to llvm.org. Also, I would be less
worried about the absence of omp support than the impact autovectorization in 
FSF gcc
on the code. You will see limited autovectorization from gcc 4.2.1 compared to
gcc 4.7.1. For example a quick and dirty test with "-O3 -ffast-math 
himenoBMTxpa.c"
on Xcode 4.5.2 shows...

 MFLOPS measured

llvm-gcc    gcc 4.7.1  Apple clang 4.1  llvm.org clang 3.2
220.981521  442.499988 219.897471       439.675728

Note that llvm clang won't default autovectorization on at -O3
until the 3.3 release and even without that clang 3.2 matches
gcc 4.7.1 in code execution. I am also told that -ffast-math
will be much improved in clang 3.3 as well. So the llvm32 package
(which builds against the system libstdc++) is a completely viable
option here.

> 
> -- 
> Alexander Hansen, Ph.D.
> Fink User Liaison
> My package updates: http://finkakh.wordpress.com/

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Fink-devel mailing list
Fink-devel@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to