# PyTorch won't run via GPU (CUDA)

**URL:** <https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558>\
**Category:** torch.package / torch::deploy\
**Created:** [January 4, 2023, 6:08am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558 "2023-01-04T06:08:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vilad](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/vilad/32/56128_2.png) [@vilad](https://discuss.pytorch.org/u/vilad)\
**Post date:** [January 4, 2023, 6:08am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/1 "2023-01-04T06:08:22Z")

</div>

I’m trying to run the code using the GPU (cuda), but it gives me an error.

I decided to check the result:

As I understand it, I just can’t use the GPU…

Here’s my video card just in case: **NVIDIA GeForce GT 630M**

Used: `nvcc --version`  
Output:

```auto
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Mon_Oct_24_19:40:05_Pacific_Daylight_Time_2022
Cuda compilation tools, release 12.0, V12.0.76
Build cuda_12.0.r12.0/compiler.31968024_0

```

Used:

```auto
available_gpus = [torch.cuda.device(i) for i in range(torch.cuda.device_count())]
print("List Device:\t", available_gpus)

```

Output: `List Device: []`  
**::!!!NEXT!!!::**  
Used:

```auto
device = torch.device("cuda" if (torch.cuda.is_available()) else "cpu")
print("Device:\t\t", device)
print("CUDA GPU:\t", torch.cuda.is_available())

```

Output:

```auto
Device: cpu
CUDA GPU: False

```

**::!!!NEXT!!!::**  
used:

```auto
torch.cuda.get_device_name(0)
# and
torch.cuda.current_device()

```

output:

```auto
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

```

**Here are some more errors when running other code.:**

```auto
UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at ..\c10\cuda\CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() > 0
Warning: caught exception 'CUDA driver initialization failed, you might not have a CUDA gpu.', memory monitor disabled

```

**Please help, explain in detail what to do, specifically for me: “Download this, then write it, install it like this, write it like this, and so on.”**

**Thank you in advance.**

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [January 4, 2023, 6:15am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/2 "2023-01-04T06:15:34Z")

</div>

Based on the initial error messages you might have installed the CPU-only binary, but nevertheless your GPU is too old.  
The GT 630M is from the Fermi family and uses compute capability 2.1 which is not supported anymore as the PyTorch binaries ship for compute capabilities 3.7-8.6.

---

<div class="post-metadata">

**Author:** ![vilad](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/vilad/32/56128_2.png) [@vilad](https://discuss.pytorch.org/u/vilad)\
**Post date:** [January 4, 2023, 6:21am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/3 "2023-01-04T06:21:30Z")

</div>

And I have no way to use the GPU?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [January 4, 2023, 6:25am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/4 "2023-01-04T06:25:16Z")

</div>

No, since Fermi (compute capability 2.1) was dropped in CUDA 9.0 while we are currently using 11.6-11.8.

---

<div class="post-metadata">

**Author:** ![Dana\_Ludwig](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/dana_ludwig/32/55969_2.png) [@Dana\_Ludwig](https://discuss.pytorch.org/u/Dana_Ludwig)\
**Post date:** [January 10, 2023, 10:34am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/5 "2023-01-10T10:34:27Z")

</div>

I’ve googled that AssertionError, and in every case I’ve seen, it always was triggered by the same command: ‘current\_device()’. My install was exactly pasted from the PyTorch installation instructions:

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

Could the bug be in ‘current\_device()’ instead?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [January 10, 2023, 10:38am UTC](https://discuss.pytorch.org/t/pytorch-wont-run-via-gpu-cuda/169558/6 "2023-01-10T10:38:36Z")

</div>

No, the bug is not in any PyTorch-related code and the Fermi CUDA architecture is just not supported anymore as previously described.
