3

i am trying to parallelize a loop with prange:

cdef fun(double [::1] someData)) nogil:
    #direct call to a external c function
    C_function(&someData[0])

#....
def parallelEvaluate(np.ndarray[np.double_t] largerArray):
    #....
    cdef np.ndarray[np.double_t] array
    cdef np.ndarray[np.int] arbitraryIndices
    for n in prange(loopLength, nogil=true):
        with gil:
            arbitraryIndices = # ... indices dependent on n
            array = np.copy( largerArray[ arbitraryIndices]  ) # copy of a non cont. array to the cont. 'array'
        fun(array)

However, this fails with: Fatal Python error: PyThreadState_Get: no current thread

What is the reason for this behavior?

Thank you!

mneuner
  • 433
  • 5
  • 25
  • There's a few questions with similar errors (e.g. http://stackoverflow.com/questions/35640529/what-does-fatal-python-error-pythreadstate-get-no-current-thread-mean) and they imply that you've probably linked against a different Python library to the one your using. – DavidW Feb 09 '17 at 10:27

1 Answers1

2

Ok figured it out:

The implicit conversion from np.ndarray does not work; i solved it with an additional memoryview slice.

mneuner
  • 433
  • 5
  • 25