Process hangs when I call torch.cuda.is_available()

Hello,

I am a beginner and I have a problem when I try to run a check to determine if I should use CUDA ( torch.cuda.is_available()) my process hangs.
I’m on Linux.
My version of torch are:

pip list | grep torch
torch                        2.0.1+cu117
torchaudio                   2.0.2+cu117
torchvision                  0.15.2+cu117

.
nvidia-smi:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Quadro P400                     On | 00000000:73:00.0 Off |                  N/A |
| 34%   39C    P8               N/A /  30W|     56MiB /  2048MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      1006      G   /usr/lib/xorg/Xorg                           54MiB |
+---------------------------------------------------------------------------------------+

I have the version 12.1.0 of CUDA.

When I call torch.cuda.version it gives me 11.7.

Does someone knows what’s going on?

Do you see any active process in top and could you attach a gdb session to the hanging process to create a stacktrace?

There is indeed an active process in top taking a lot of CPU % but If I try to attach it with gdb, the gdb process hangs. I think the process is waiting for I/O access and can’t be kill