3

I am trying to re-write in cython a fortran subroutine that uses openmp. I have found no difficulty in re-writing the fortran subroutine itself in cython. The non openmp version works fine. However, I am not sure what to do about the openmp directive....

!$omp parallel do private(x, y, z)

In cython, I understand that you get the openmp parallel do using cython.parallel.prange. However, I don't see how to declare private variables for the loop.

Is this even possible?

thanks for any insight you can provide.

4

1 回答 1

1

对的,这是可能的。文档说:

如果您在 prange 块中分配给变量,则它变为 lastprivate,这意味着该变量将包含上次迭代的值。.....分配给与块并行的变量将是私有的并且在块之后不可用,因为没有顺序最后一个值的概念。

于 2015-05-21T09:58:59.310 回答