Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 5ba5fa8

Browse files
authored
Add Habana HPU check in setup.py (#1573)
Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com>
1 parent 5e5e17c commit 5ba5fa8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def is_intel_gpu_available():
1717
import intel_extension_for_pytorch as ipex
1818
return hasattr(torch, "xpu") and torch.xpu.is_available()
1919

20+
21+
def is_habana_hpu_available():
22+
try:
23+
import habana_frameworks.torch.hpu as hthpu
24+
return True
25+
except ImportError:
26+
return False
27+
28+
2029
def check_env_flag(name: str, default: bool = False) -> bool:
2130
if default: # if a flag meant to be true if not set / mal-formatted
2231
return not os.getenv(name, "").upper() in ["OFF", "0", "FALSE", "NO", "N"]
@@ -37,7 +46,7 @@ def check_env_flag(name: str, default: bool = False) -> bool:
3746
SKIP_RUNTIME = True
3847
RUNTIME_ONLY = False
3948
IS_INTEL_GPU = True
40-
else:
49+
elif not is_habana_hpu_available():
4150
result = subprocess.Popen(
4251
"pip install -r requirements-cpu.txt", shell=True)
4352
result.wait()

0 commit comments

Comments
 (0)