Reputation: 21
(theano_p27) ubuntu@ip-***-**-**-***:~$ device=cuda0,floatX=float32 GPUARRAY_CUDA_VERSION=80 python test.py
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/theano_p27/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 227, in <module>
use(config.device)
File "/home/ubuntu/anaconda3/envs/theano_p27/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 214, in use
init_dev(device, preallocate=preallocate)
File "/home/ubuntu/anaconda3/envs/theano_p27/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 99, in init_dev
**args)
File "pygpu/gpuarray.pyx", line 658, in pygpu.gpuarray.init
File "pygpu/gpuarray.pyx", line 587, in pygpu.gpuarray.pygpu_init
GpuArrayException: cuInit: CUDA_ERROR_UNKNOWN: unknown error
[Elemwise{exp,no_inplace}(<TensorType(float32, vector)>)]
Looping 1000 times took 2.717710 seconds
Result is [1.2317803 1.6187934 1.5227807 ... 2.2077181 2.2996776 Used the cpu
I am trying to use Amazon Web Services EC2 to run a GPU and I am getting this error when I am trying to run a test to get my code to run my gnu but its giving me this error.
Please help
Edit: The code I am running is the test code from the Theano website
from theano import function, config, shared, tensor
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, tensor.Elemwise) and
('Gpu' not in type(x.op).__name__)
for x in f.maker.fgraph.toposort()]):
print('Used the cpu')
else:
print('Used the gpu')
Upvotes: 2
Views: 704
Reputation: 5065
In response to the followup comments. In order to configure and use an GPU on AWS with the Deep Learning AMI the following instances are recommended (source):
Amazon EC2 P3 Instances have up to 8 NVIDIA Tesla V100 GPUs.
Amazon EC2 P2 Instances have up to 16 NVIDIA NVIDIA K80 GPUs.
Amazon EC2 G3 Instances have up to 4 NVIDIA Tesla M60 GPUs.
Check out EC2 Instance Types and choose Accelerated Computing to see the different GPU instance options.
In addition you can try Elastic GPUs.
Finally, it order to use GPU instances you typically needed to install the appropriate drivers from the Nvidia site. Review the quoted text above for the GPU type. Download the driver and run it; for example:
./NVIDIA-Linux-x86_64-384.81.run
You can also pass the -silent
flag to install it with config management or otherwise. Also, keep in mind that you must install the drivers on the instance size you intend to use. If you create an AMI image where you installed the drivers on a p3.2xlarge
and then try to run something on a p3.8xlarge
you will likely need to re-install the drivers.
Upvotes: 1