[SciPy-user] openmp and weave?

Daniel Wheeler daniel.wheeler2@gmail....
Fri Apr 11 11:23:03 CDT 2008


Just following up from the email below. I got openmp + weave working
on an Altix 64 node machine, but the speedups for a simple matrix
multiplication are horrendous
<https://www.matforge.org/msel/wiki/2008/04/11/11.50>. This is using
an intel compiler for weave, and using gcc 4.1 for scipy + numpy. I
have no idea why the results are so poor.

Cheers

On Mon, Apr 7, 2008 at 2:23 PM, Daniel Wheeler
<daniel.wheeler2@gmail.com> wrote:
> On Wed, Nov 7, 2007 at 6:55 PM, william ratcliff
>  <william.ratcliff@gmail.com> wrote:
>   > Has anyone had any luck using weave with openMP?
>
>  Yes. I have been trying a test case and getting reasonable speed ups.
>  You'll need gcc version 4.3, 4.2 doesn't seem to work. I have recorded
>  some of the results on the pages below. Be warned, I am inexperienced
>  in parallel computing so there is a chance of gross errors in my
>  thinking and coding.
>
>    <https://www.matforge.org/msel/wiki/2008/04/04/16.48>
>    <https://www.matforge.org/msel/wiki/2008/03/24/15.37>
>    <https://www.matforge.org/msel/wiki/2008/03/20/15.46>
>
>  The following is the test code for the above results.
>
>    <https://www.matforge.org/msel/wiki/2008/04/07/13.24>
>
>  Note that there is no need to recompile everything with 4.3, only
>  weave. Getting 4.3 built was a little involved. The links above
>  provide some rudimentary instructions.
>
>  The above results are for a machine with 2 and another with 8 nodes. I
>  have also been evaluating openmp on a 64 node Altix machine. There are
>   a number of issues with building scipy and numpy that have been
>  resolved mostly concerning the SGI's scientific library, but I am
>  currently having issues with getting weave to compile on the Altix.
>  This seems to be due to having all the python stuff compiled with gcc,
>
>
> but using the Intel compiler for weave.
>
>  Cheers
>
>
>
>   > If so, what did you
>   >  have to do?  I've started by updating my compiler to MinGW:
>   >  gcc-4.2.1-dw-2-2 (and similarly for g++), but am running into problems
>   >  with code written in weave that doesn't use any of openmp:
>   >
>   >  Here is the code:
>   >
>   >  import numpy as N
>   >  import weave
>   >  from weave import converters
>   >
>   >
>   >
>   >  def blitz_interpolate(x,y):
>   >
>   >
>   >     code = """
>   >     int pts = Ny[0];
>   >  //#pragma omp parallel for
>   >     for (int i=0; i < pts-1; i++){
>   >         y(i) = sin( exp( cos( - exp( sin(x(i)) ) ) ) );
>   >      }
>   >     return_val = 3;
>   >     """
>   >     extra=["-fopenmp -Lc:/python25/ -lPthreadGC2"]
>   >     extra=[]
>   >     z=weave.inline(code,['x','y'],type_converters=converters.blitz,compiler='gcc')
>   >     print z
>   >     return
>   >
>   >
>   >
>   >
>   >
>   >  if __name__=="__main__":
>   >     x=N.arange(1000)
>   >     y=N.zeros(x.shape,'d')
>   >     blitz_interpolate(x,y)
>   >     print x[35], y[35],N.sin(N.exp(N.cos(-N.exp(N.sin(x[35])))))
>   >
>   >
>   >
>   >
>   >
>   >  This works fine with version 3.4.2 of gcc, g++
>   >
>   >  Thanks,
>   >  William
>   >  _______________________________________________
>   >  SciPy-user mailing list
>   >  SciPy-user@scipy.org
>   >  http://projects.scipy.org/mailman/listinfo/scipy-user
>   >
>
>
>  --
>  Daniel Wheeler
>



-- 
Daniel Wheeler


More information about the SciPy-user mailing list