[Beowulf] bizarre scaling behavior on a Nehalem

Christian Bell christian at myri.com
Wed Aug 12 08:36:35 PDT 2009

On Aug 12, 2009, at 11:14 AM, Bill Broadley wrote:

> * For the compilers that tend to be better at stream (open64 and  
> pathscale),
>  you lose the performance if you just replace double a[],b[],c[] with
>  double *a,*b,*c. Patch[1] available.  I don't have a work around for
>  this, suggestions welcome.  Is it really necessary for dynamic arrays
>  to be substantially slower than static?

Yes -- when pointers, the compiler assumes (by default) that the  
pointers can alias each other, which can prevent aggressive  
optimizations that are otherwise possible with arrays.  C99 has  
introduced the 'restrict' keyword to allow programmers to assert that  
pointers of the same type cannot alias each other.  However, restrict  
is just a hint and some compilers may or may not take advantage of it.

You can also consult your compiler's documentation to see if there are  
other compiler-specific hints (asserting no loop-carried dependencies,  
loop fusion/fission).  I remember stacking half a dozen pragmas over a  
3-line loop on a Cray C compiler years ago to ensure that accesses  
where suitably optimized (or in this case, vectorized).

	. . christian

More information about the Beowulf mailing list