Skip to content

Commit 2c455b7

Browse files
committed
Do not load libomptarget if there's no gpu to avoid error
1 parent 6aeecfd commit 2c455b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

numba/openmp/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ def _init():
480480
if sys_platform.startswith("darwin") or sys_platform.startswith("win32"):
481481
return
482482

483+
# libomptarget errors out if gpu is not available.
484+
if not numba_cuda.is_available():
485+
return
486+
483487
omptargetlib = llvm_libpath + "/libomptarget.so"
484488
if DEBUG_OPENMP >= 1:
485489
print("Found OpenMP target runtime library at", omptargetlib)

0 commit comments

Comments
 (0)