aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorhako-mikan <122196982+hako-mikan@users.noreply.github.com>2023-11-09 12:57:57 +0000
committerGitHub <noreply@github.com>2023-11-09 12:57:57 +0000
commit816096e642187a18b11e2729c42c0b5f677f047d (patch)
tree8127b07b946b376d4276e2169ceffb7c2e64ba09 /modules/devices.py
parent6b9795849d497b41514aa9462690cf7c2802e4f6 (diff)
parent5e80d9ee99c5899e5e2b130408ffb65a0585a62a (diff)
downloadstable-diffusion-webui-gfx803-816096e642187a18b11e2729c42c0b5f677f047d.tar.gz
stable-diffusion-webui-gfx803-816096e642187a18b11e2729c42c0b5f677f047d.tar.bz2
stable-diffusion-webui-gfx803-816096e642187a18b11e2729c42c0b5f677f047d.zip
Merge branch 'dev' into master
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/devices.py b/modules/devices.py
index c01f0602..1d4eb563 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -60,7 +60,8 @@ def enable_tf32():
# enabling benchmark option seems to enable a range of cards to do fp16 when they otherwise can't
# see https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4407
- if any(torch.cuda.get_device_capability(devid) == (7, 5) for devid in range(0, torch.cuda.device_count())):
+ device_id = (int(shared.cmd_opts.device_id) if shared.cmd_opts.device_id is not None and shared.cmd_opts.device_id.isdigit() else 0) or torch.cuda.current_device()
+ if torch.cuda.get_device_capability(device_id) == (7, 5) and torch.cuda.get_device_name(device_id).startswith("NVIDIA GeForce GTX 16"):
torch.backends.cudnn.benchmark = True
torch.backends.cuda.matmul.allow_tf32 = True