# Ignore specific GPU with pytorch in Anaconda

**URL:** <https://discuss.pytorch.org/t/ignore-specific-gpu-with-pytorch-in-anaconda/222746>\
**Category:** Uncategorized\
**Created:** [August 29, 2025, 3:35pm UTC](https://discuss.pytorch.org/t/ignore-specific-gpu-with-pytorch-in-anaconda/222746 "2025-08-29T15:35:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KFrank](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@KFrank](https://discuss.pytorch.org/u/KFrank)\
**Post date:** [August 29, 2025, 4:51pm UTC](https://discuss.pytorch.org/t/ignore-specific-gpu-with-pytorch-in-anaconda/222746/2 "2025-08-29T16:51:03Z")

</div>

Hi Asmaron!

> [@Asmaron](#):
>
> how can I make sure that Torch only tries to run off GPU-0, aka the 3070 while ignoring the 1070 and it’s insufficient CUDA version

Run the process that runs your pytorch code under control of the  
`CUDA_VISIBLE_DEVICES` environment variable. See, for example, this  
thread:

> [@What does “export CUDA\_VISIBLE\_DEVICES=1” really do?](https://discuss.pytorch.org/t/what-does-export-cuda-visible-devices-1-really-do/90340):
>
> In a multi-GPU computer(Ubuntu 16), I want to use GPU1 and do the following setting in the shell: $ export CUDA\_VISIBLE\_DEVICES=1 $ python But, I got an error when I set the device of the tensor: Python 3.8.3 (default, May 19 2020, 18:47:26) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. \>\>\> import torch \>\>\> a = torch.Tensor(1).to("cuda:0") \>\>\> a = torch.Tensor(1).to("cuda:1") Traceback (most recent call last): File "\<stdin\>",…

For example, if you were to run your pytorch code under a simple python  
session (on unix – I’m not sure how to modify this for windows), you would  
run

```auto
CUDA_VISIBLE_DEVICES=0 python

```

to launch your python session.

Best.

K. Frank

---

_[View the full topic](https://discuss.pytorch.org/t/ignore-specific-gpu-with-pytorch-in-anaconda/222746)._
