I have created an EC2
instance with GPU
g4dn.xlarge
and launched it. I want to run some code from command line and this code is pytorch
based. While pycuda
is able to identify the GPUs
the pytorch
is not able to identify it.
import pycuda.driver as cuda
import torch
cuda.init()
num_gpus = cuda.Device.count()
print(f"Number of GPUs: {num_gpus}")
print("is torch cuda avaialable",torch.cuda.is_available())
print("torch cuda count",torch.cuda.device_count())
the output for the above code will be
Number of GPUs: 1
is torch cuda avaialable False
torch cuda count 0
Here are the pytorch
and cuda
version I am using
pytorch 2.0.1 cpu_py310h07ccb54_0
cudatoolkit 11.7.0 h254b3b0_10 nvidia
pycuda 2021.1 py310h06b8198_3 conda-forge