Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion numba/dppl/dppl_lowerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ def lower_parfor_rollback(lowerer, parfor):
msg = "Parfor lowered on DPPL-device"
print(msg, parfor.loc)
except Exception as e:
msg = "Failed to lower parfor on DPPL-device.\nTo see details set environment variable NUMBA_DEBUG=1"
msg = "Failed to lower parfor on DPPL-device.\nTo see details set environment variable NUMBA_DPPL_DEBUG=1"
warnings.warn(NumbaPerformanceWarning(msg, parfor.loc))
raise e
finally:
Expand Down
21 changes: 9 additions & 12 deletions numba/dppl/examples/dppl_with_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@
from numba import dppl, njit, prange
import dpctl


@njit
def g(a):
return a + 1

def add_two_arrays(b, c):
a = np.empty_like(b)
for i in prange(len(b)):
a[i] = b[i] + c[i]

#@njit(parallel={'offload':True})
@njit
def f(a, b, c, N):
for i in prange(N):
a[i] = b[i] + g(c[i])
return a


def main():
N = 10
a = np.ones(N)
b = np.ones(N)
c = np.ones(N)

if dpctl.has_gpu_queues():
with dpctl.device_context("opencl:gpu"):
f(a, b, c, N)
gpu_result = add_two_arrays(b, c)
print('GPU device found. Result on GPU:', gpu_result)
elif dpctl.has_cpu_queues():
with dpctl.device_context("opencl:cpu"):
f(a, b, c, N)
cpu_result = add_two_arrays(b, c)
print('CPU device found. Result on CPU:', cpu_result)
else:
print("No device found")

Expand Down