Using Multiprocessing in Pycuda

Hi,
I wrote pycuda program for my application but when I tried to run with multiple processes, I am getting pycuda._driver.LogicError: cuModuleGetFunction failed: initialization error.

I am using import pycuda.autoinit. Could you guide me how to initialize for various processes in Py-Cuda ?

How many GPUs do you have? Are these sharing a single GPU? If so, what is the compute mode of that GPU set to?

Hello,
I use only single GPU which is Gtx 1070 and the computing mode is default set to 0.

This may explain what you are doing wrong:

https://stackoverflow.com/questions/46904699/how-use-pycuda-in-multiprocessing

For example, I wouldn’t use autoinit, and I would be sure not to init CUDA in the master process.

I had a similar issue, and solve it by adding a line of code on the main process, before start the subprocesses:

 multiprocessing.set_start_method('spawn')

Source: [https://stackoverflow.com/a/55812288/8664574]