is this something I do a 'root' ? Or via PyCuda? I am afraid I wont
have access to 'root'
On Thu, Dec 3, 2015 at 6:01 PM, Andreas Kloeckner
<lists(a)informa.tiker.net> wrote:
Keith Brown <keith6014(a)gmail.com> writes:
I have several GPUs and I want to distribute my
tasks to each GPU. I
would like to use multiprocessing.Pool() to accomplish it
import random
import pycuda.gpuarray as gpuarray
import atexit
import pycuda.driver as cuda
import pycuda.autoinit as autoinit
import time
import numpy as np
import skcuda.linalg as linalg
import skcuda
import multiprocessing as mp
import pycuda.driver as drv
def my_proc(n):
drv.init()
dev = drv.Device(n)
ctx = dev.make_context()
atexit.register(ctx.pop)
linalg.init()
a=np.ones((185,185)).astype(np.float32)
a_gpu = gpuarray.to_gpu(a)
c_gpu = linalg.dot(a_gpu,a_gpu)
return c_gpu.get()
r=[]
Pool=mp.Pool(10)
for i in range(1000):
Pool.apply_async(my_proc,(random.randint(0,1),))
I keep getting
pycuda._driver.LogicError: cuCtxPopCurrent failed: invalid device context
Is there somthing I should be doing?
If you have the GPUs set to exclusive mode, then PyCUDA should take care
of round-robin device selection on its own.
Andreas