【发布时间】:2020-12-27 01:11:17
【问题描述】:
void worker(int *P,int l):
cdef i
with nogil, parallel():
for i in prange(l):
P[i]=1
我正在尝试在 cython 中使用具有多线程的数组.. 但我收到此错误:
没有 GIL 就不允许来自 Python 的强制
数组 P 的初始化如下:
cdef int l=500000
cdef int *P=<int *> malloc(l* sizeof(int))
有什么帮助吗?
【问题讨论】:
标签: python arrays multithreading cython