Re: [f2py] threading with f2py

charlie strauss <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
hey stweart, nice to hear from you.  oddly I was just thinking of you  
this morning.

this issue sort of finally was the straw that made me think I better  
make the transition to c++ for real.  not look forward to this.   
f90+python is such a sweet thing.

I've been looking at openMP as a nice solution.  And while it works in  
f90, i've had trouble configuring a self consisten set of compilers  
and python distros that work.  but since gcc supports it, c works fine.

This then got me looking at how to use BLAS in C and C++.    I see  
boost has uBlas.

Anyhow the thing I'm trying to figure out now is SIMD.  on most  
computers these days BLAS is all SIMD, so you get SIMD for free for  
the functions you can find in BLAS.  So that should be the same in  
Fortran or C/C++

But what about everything else?

in fortran90 I can write:

A = A+1

or

B = cos(A)

C = A*B

and A can be a matrix.  A smart compiler can in principle do that all  
in SIMD without me having to know anything.  and with openMP those can  
even be threaded in fortran:

!OMP  parallel workshare
B = cos(A)

But there's no open workshare command in C++.

Googling around I found discussions of something called boost::SIMD   
but nothing documenting it on the BOOST site so I don't know what it  
even is.

So with that preamble here's the question:

are there vector ops and automatic SIMD in boost or C++???

that is how do I write
B = cos(A)
for vectors in C++ and will it use SIMD to accelerate it?






On Jul 18, 2009, at 4:45 PM, Stuart Mentzer wrote:

> Greetings Charlie,
>
> We went through this with a recent project and we found
> that running the Fortran in a thread using
>  !f2py threadsafe
> does indeed let the Fortran yield back to Python but it
> doesn't work if you want to use callbacks from Fortran,
> which we did. We ended up using multiprocessing and it
> is working well.
>
> Multiprocessing takes longer to start each process than
> a thread and you have to make sure the state you need to
> pass the process is "pickleable" but that only matters
> in practice on Windows because it lacks an OS fork.
>
> (If you think I can be of any further assistance just
> give me a call.)
>
> Stuart
>
>
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users

Charlie Strauss
Bioscience Division
[email protected]
505 665 4838
Quidquid latine dictum sit, altum sonatur.

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.