Run Python function in parallel on GPU

Hi, Matthew. Thanks for the reply. I understand your concern. I tried to run it myself. But using the simulator running on the ray worker requires a CUDA context. In normal multiprocessing, I can just use:

context=mp.get_context('spawn')#NOTE: without spawn context will fail as it uses CUDA!
self.ps = context.Process(target=worker, args=(...))

And if not specifying context like above, I would receive errors like follows:

#can be solved with 'spawn' context
 CUDA error at /root/liuwj/Skeletal-Fluid/src/MeshLoad/MeshDatatGPUKernel.cu:37 code=101(cudaErrorInvalidDevice) "cudaGetLastError()"

When I replace multiprocessing with ray, I found the exact same error message is produced. Thus I was not able to test that with ray workers. I guess it might be the problem of the context, but I was not able to finish my test. Thus I raised a new thread here.