Skip to content

Commit

Permalink
l2_norm code difference fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshyoga committed May 16, 2024
1 parent ab6ecb5 commit 05a2407
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions dpbench/benchmarks/default/l2_norm/l2_norm_numba_dpex_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@dpjit
def l2_norm(a, d):
for i in nb.prange(a.shape[0]):
d[i] = 0.0
for k in range(a.shape[1]):
d[i] += np.square(a[i, k])
d[i] = np.sqrt(d[i])
1 change: 1 addition & 0 deletions dpbench/benchmarks/default/l2_norm/l2_norm_numba_mlir_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@nb.njit(parallel=True, fastmath=True)
def _l2_norm(a, d):
for i in numba.prange(a.shape[0]):
d[i] = 0.0
for k in range(a.shape[1]):
d[i] += np.square(a[i, k])
d[i] = np.sqrt(d[i])
Expand Down
1 change: 1 addition & 0 deletions dpbench/benchmarks/default/l2_norm/l2_norm_numba_npr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@nb.njit(parallel=True, fastmath=True)
def l2_norm(a, d):
for i in nb.prange(a.shape[0]):
d[i] = 0.0
for k in range(a.shape[1]):
d[i] += np.square(a[i, k])
d[i] = np.sqrt(d[i])
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void l2_norm_impl(queue Queue,
.submit([&](handler &h) {
h.parallel_for<theKernel<FpTy>>(range<1>{npoints}, [=](id<1> myID) {
size_t i = myID[0];
d[i] = 0.0;
for (size_t k = 0; k < dims; k++) {
d[i] += a[i * dims + k] * a[i * dims + k];
}
Expand Down

0 comments on commit 05a2407

Please sign in to comment.