[Tutor] OpenMP

Emile van Sebille emile at fenx.com
Sat Oct 9 19:10:20 CEST 2010

On 10/9/2010 9:55 AM Ahmed AL-Masri said...
> Hi,
> I have searched about how to use openMP using python and I couldn't fine any helpful info. anyone can help me on this.
> My idea is that to use the different processer core for each section.
> for ex.
> lets say I have two loops and I want to test in which processer go through.
> ## core one should handle this
> a=[]
> for I in range (100):
>     s= 10*I
>     a.append( s)
> ## core two should handle this
> b=[]
> for f in range (100):
>     h= 10*f
>     b.append( h)
> ## collecting the data in one data file
> data=[a, b]
> my question is how to do that and is it possible in python to go from line to line after give the order to core one to process than we go to next core for the second process..
> Really interesting to speed up the process based on no of CPUs that we have using python.
> Looking forward to seeing your suggestions,

Each python process is limited to running on a single core, but multiple 
processes can run in different cores.  I'm not aware of a way to direct 
which core a process will be run under, but perhaps there's a OS method 
of doing so.  For more information on the python limitations, google 
around for python and GIL (global interpreter lock).



More information about the Tutor mailing list