0

I am using Linux Mint 21.1 and I've download and installed cuda_12.2.1_535.86.10_linux.run from https://developer.nvidia.com/cuda-downloads.

After cuda installation, I tried to run /usr/local/cuda/extras/demo_suite/deviceQuery and got the following:

/usr/local/cuda/extras/demo_suite/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "NVIDIA RTX A4000"
  CUDA Driver Version / Runtime Version          12.2 / 12.2
  CUDA Capability Major/Minor version number:    8.6
  Total amount of global memory:                 16101 MBytes (16882663424 bytes)
  (48) Multiprocessors, (128) CUDA Cores/MP:     6144 CUDA Cores
  GPU Max Clock rate:                            1560 MHz (1.56 GHz)
  Memory Clock rate:                             7001 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 4194304 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
  Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1536
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device supports Compute Preemption:            Yes
  Supports Cooperative Kernel Launch:            Yes
  Supports MultiDevice Co-op Kernel Launch:      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.2, CUDA Runtime Version = 12.2, NumDevs = 1, Device0 = NVIDIA RTX A4000
Result = PASS

So, I understand the cuda installation (drivers, etc) is ok!

After this, I've installed Anaconda3-2023.07-1-Linux-x86_64. But after installantion, I tried to install pytorch:

$ conda install pytorch torchvision cudatoolkit -c pytorch

but after pytorch installation I am having problems when trying to get the available gpus:

$ python3 -c "import torch; print(torch.cuda.is_available())"
False

Now I get nowhere, since cuda installation seems alrigh.

After some thinking. I tried to run the following code:

import torch
print( torch.cuda.current_device())     # The ID of the current GPU.
print(torch.cuda.get_device_name(0))  # The name of the specified GPU, where id is an integer.
print(torch.cuda.device(0))           # The memory address of the specified GPU, where id is an integer.
print(torch.cuda.device_count())

and I got

Traceback (most recent call last):
  File "/home/iaciber2/test_pytorch.py", line 2, in <module>
    print( torch.cuda.current_device())     # The ID of the current GPU.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/iaciber2/anaconda3/envs/dl_pytorch/lib/python3.11/site-packages/torch/cuda/__init__.py", line 674, in current_device
    _lazy_init()
  File "/home/iaciber2/anaconda3/envs/dl_pytorch/lib/python3.11/site-packages/torch/cuda/__init__.py", line 239, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Any ideas ?

ricksant
  • 117
  • 9

1 Answers1

1

after all, I found out that a cpu version of pytorch have been installed.

Using:
import torch

print(torch.version.cuda)

I got "None", so the installed pytorch did not support GPU.

So, to force an gpu support installation :

$ conda install  pytorch=2.0.1=py3.11_cuda11.8_cudnn8.7.0_0 torchvision torchaudio pytorch-cuda=11.8 cudatoolkit -c pytorch -c nvidia

Thats all

ricksant
  • 117
  • 9