W
Wout Megchelenbrink
I use openMp in a C-extension that has an interface with Python.
In its simplest form I do this:
== code ==
#pragma omp parallel
{
#pragma omp for
for(int i=0; i<10; i++)
{
// multiply some matrices in C
}
}
== end of code ==
This all works fine, and it uses the number of cores I have. But if I import numpy in my python session BEFORE I run the code, then it uses only 1 core (and omp_num_procs also returns 1 core, instead of the maximum of 8 cores).
So how does numpy affect openMp, and does it have anything to do with the GIL or something? I don't use any Python object in my parallel region.
Any help would be appreciated!
Wout
In its simplest form I do this:
== code ==
#pragma omp parallel
{
#pragma omp for
for(int i=0; i<10; i++)
{
// multiply some matrices in C
}
}
== end of code ==
This all works fine, and it uses the number of cores I have. But if I import numpy in my python session BEFORE I run the code, then it uses only 1 core (and omp_num_procs also returns 1 core, instead of the maximum of 8 cores).
So how does numpy affect openMp, and does it have anything to do with the GIL or something? I don't use any Python object in my parallel region.
Any help would be appreciated!
Wout