[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
10bc8aa538
commit
534ba3bfa2
1 changed files with 16 additions and 13 deletions
|
|
@ -1175,6 +1175,7 @@ def _has_usable_nvidia_gpu() -> bool:
|
||||||
cvd = os.environ.get("CUDA_VISIBLE_DEVICES")
|
cvd = os.environ.get("CUDA_VISIBLE_DEVICES")
|
||||||
if cvd is not None and cvd.strip() in ("", "-1"):
|
if cvd is not None and cvd.strip() in ("", "-1"):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _lists_a_gpu(exe: str) -> bool:
|
def _lists_a_gpu(exe: str) -> bool:
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
|
|
@ -1200,19 +1201,21 @@ def _has_usable_nvidia_gpu() -> bool:
|
||||||
if _path_exe:
|
if _path_exe:
|
||||||
candidates.append(_path_exe)
|
candidates.append(_path_exe)
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
candidates.extend((
|
candidates.extend(
|
||||||
os.path.join(
|
(
|
||||||
os.environ.get("ProgramFiles", r"C:\Program Files"),
|
os.path.join(
|
||||||
"NVIDIA Corporation",
|
os.environ.get("ProgramFiles", r"C:\Program Files"),
|
||||||
"NVSMI",
|
"NVIDIA Corporation",
|
||||||
"nvidia-smi.exe",
|
"NVSMI",
|
||||||
),
|
"nvidia-smi.exe",
|
||||||
os.path.join(
|
),
|
||||||
os.environ.get("SystemRoot", r"C:\Windows"),
|
os.path.join(
|
||||||
"System32",
|
os.environ.get("SystemRoot", r"C:\Windows"),
|
||||||
"nvidia-smi.exe",
|
"System32",
|
||||||
),
|
"nvidia-smi.exe",
|
||||||
))
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
for _candidate in candidates:
|
for _candidate in candidates:
|
||||||
if _candidate != _path_exe and not os.path.isfile(_candidate):
|
if _candidate != _path_exe and not os.path.isfile(_candidate):
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue