Cupy get error in multithread.pool if GPU already used

佐手、 提交于 2019-12-06 09:06:30

This issue is not specific to CuPy. Due to the limitation of CUDA, processes cannot be forked after CUDA initialization.

You need to use multiprocessing.set_start_method('spawn') (or forkserver), or avoid initializing CUDA (i.e., do not use CuPy API except import cupy) until you fork child processes.

When I tried multiprocessing with cupy before, I needed to use spawn context.

ctx = multiprocessing.get_context('spawn')
pool = ctx.Pool(4)

I don't know this resolves your problem but can you try it?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!