Skip to content

Commit af6561a

Browse files
authored
Update cuda_specs.py
1 parent 4e31305 commit af6561a

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

bitsandbytes/cuda_specs.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import dataclasses
2-
import logging
3-
import re
2+
import logging
3+
import re
44
import subprocess
55
from functools import lru_cache
66
from typing import Optional
@@ -78,25 +78,25 @@ def get_cuda_specs() -> Optional[CUDASpecs]:
7878
return None
7979

8080

81-
def get_rocm_gpu_arch() -> str:
82-
"""Get ROCm GPU architecture."""
83-
logger = logging.getLogger(__name__)
84-
try:
85-
if torch.version.hip:
86-
result = subprocess.run(["rocminfo"], capture_output=True, text=True)
87-
match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout)
88-
if match:
89-
return "gfx" + match.group(1)
90-
else:
91-
return "unknown"
92-
else:
93-
return "unknown"
94-
except Exception as e:
95-
logger.error(f"Could not detect ROCm GPU architecture: {e}")
96-
if torch.cuda.is_available():
97-
logger.warning(
98-
"""
99-
ROCm GPU architecture detection failed despite ROCm being available.
100-
""",
101-
)
102-
return "unknown"
81+
def get_rocm_gpu_arch() -> str:
82+
"""Get ROCm GPU architecture."""
83+
logger = logging.getLogger(__name__)
84+
try:
85+
if torch.version.hip:
86+
result = subprocess.run(["rocminfo"], capture_output=True, text=True)
87+
match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout)
88+
if match:
89+
return "gfx" + match.group(1)
90+
else:
91+
return "unknown"
92+
else:
93+
return "unknown"
94+
except Exception as e:
95+
logger.error(f"Could not detect ROCm GPU architecture: {e}")
96+
if torch.cuda.is_available():
97+
logger.warning(
98+
"""
99+
ROCm GPU architecture detection failed despite ROCm being available.
100+
""",
101+
)
102+
return "unknown"

0 commit comments

Comments
 (0)