我想在Python3中使用多处理器和多处理器。我可以像运行一个简单的测试用例,执行以下操作:CUDA可能的原因是Python3/Theano的设备属性错误?
>> target about to use
>> master about to use
>> Using gpu device 1: GeForce GTX 1080 (CNMeM is enabled with initial size: 50.0% of memory, cuDNN 5105)
>> target is using
>> Using gpu device 0: GeForce GTX 1080 (CNMeM is enabled with initial size: 50.0% of memory, cuDNN 5105)
>> master is using
>> master will join
>> target is exiting
>> master is exiting
但是,在一个更复杂的:
import theano
import theano.tensor as T
import multiprocessing as mp
import time
# import lasagne
def target():
import theano.sandbox.cuda
print("target about to use")
theano.sandbox.cuda.use('gpu1')
print("target is using")
import lasagne
time.sleep(15)
print("target is exiting")
x = T.scalar('x', dtype='float32')
p = mp.Process(target=target)
p.start()
time.sleep(1)
import theano.sandbox.cuda
print("master about to use")
theano.sandbox.cuda.use('gpu0')
print("master is using")
import lasagne
time.sleep(4)
print("master will join")
p.join()
print("master is exiting")
当我运行这一点,我的主人和衍生的过程中每个使用GPU顺利拿到代码库,当我尝试设置相同的方案,将生成的辅助失败:
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device 1 failed:
Unable to get properties of gpu 1: initialization error
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device gpu failed:
Not able to select available GPU from 2 cards (initialization error).
而且我有一个很难追了下去是什么导致了这一点。在上面的代码片段中,如果lasagne
在分叉之前被导入,则会重新创建问题。但是我设法阻止我的代码导入lasagne
,直到分叉并尝试使用GPU(我选中了sys.modules.keys()
)之后,问题仍然存在。除了theano
本身和theano.tensor
在分叉之前被导入之外,我没有看到任何与Theano相关的内容,但在上面的示例中没有问题。
有没有其他人追逐类似的东西?
主机系统的操作系统是什么? –
Ubuntu 16.04,CUDA 8.0和Theano 0.9-dev4。 –
可能是'出血的边缘'部分可能是问题。你有没有试用稳定版本? –