Fixed openmp usage

This commit is contained in:
Guilhem Lavaux 2015-02-10 14:20:09 +01:00
parent ab36a5b24a
commit 8198cef3c5
3 changed files with 10 additions and 7 deletions

View file

@ -6,7 +6,6 @@ import numpy as np
cimport numpy as npx
cimport cython
from copy cimport *
from openmp cimport omp_get_max_threads, omp_get_thread_num
ctypedef npx.float64_t DTYPE_t
DTYPE=np.float64
@ -18,6 +17,10 @@ cdef extern from "project_tool.hpp" namespace "":
DTYPE_t compute_projection(DTYPE_t *vertex_value, DTYPE_t *u, DTYPE_t *u0, DTYPE_t rho) nogil
cdef extern from "openmp.hpp" namespace "CosmoTool":
int smp_get_max_threads() nogil
int smp_get_thread_id() nogil
@cython.boundscheck(False)
@cython.cdivision(True)
@ -850,7 +853,7 @@ def spherical_projection(int Nside,
if progress != 0:
p = pb.ProgressBar(maxval=outm.size,widgets=[pb.Bar(), pb.ETA()]).start()
N = omp_get_max_threads()
N = smp_get_max_threads()
N0 = outm.size
if booster < 0:
@ -860,7 +863,7 @@ def spherical_projection(int Nside,
job_done[:] = 0
theta,phi = hp.pix2ang(Nside, np.arange(N0))
with nogil, parallel():
tid = omp_get_thread_num()
tid = smp_get_thread_id()
for i in prange(N0):
if progress != 0 and (i%booster) == 0:
with gil: