PyTorch test
In [1]:
Copied!
import torch
import torch
In [2]:
Copied!
print(torch.cuda.is_available())
print(torch.cuda.is_available())
False
In [3]:
Copied!
print(torch.cuda.device_count())
print(torch.cuda.device_count())
0
In [4]:
Copied!
print(torch.cuda.current_device())
print(torch.cuda.current_device())
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) Cell In[4], line 1 ----> 1 print(torch.cuda.current_device()) File ~/.local/lib/python3.12/site-packages/torch/cuda/__init__.py:878, in current_device() 876 def current_device() -> int: 877 r"""Return the index of a currently selected device.""" --> 878 _lazy_init() 879 return torch._C._cuda_getDevice() File ~/.local/lib/python3.12/site-packages/torch/cuda/__init__.py:305, in _lazy_init() 300 raise RuntimeError( 301 "Cannot re-initialize CUDA in forked subprocess. To use CUDA with " 302 "multiprocessing, you must use the 'spawn' start method" 303 ) 304 if not hasattr(torch._C, "_cuda_getDeviceCount"): --> 305 raise AssertionError("Torch not compiled with CUDA enabled") 306 if _cudart is None: 307 raise AssertionError( 308 "libcudart functions unavailable. It looks like you have a broken build?" 309 ) AssertionError: Torch not compiled with CUDA enabled
In [ ]:
Copied!
torch.cuda.device(0)
torch.cuda.device(0)
In [ ]:
Copied!
torch.cuda.get_device_name(0)
torch.cuda.get_device_name(0)
In [ ]:
Copied!
In [ ]:
Copied!
In [ ]:
Copied!