Skip to content

Commit

Permalink
Merge pull request #352 from IntelPython/fix/l2_norm_diff
Browse files Browse the repository at this point in the history
Address difference in l2_norm implementations
  • Loading branch information
adarshyoga authored May 30, 2024
2 parents ab6ecb5 + ff2ddf3 commit a3575fe
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-2019]

runs-on: ${{ matrix.os }}

Expand Down
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 a3575fe

Please sign in to comment.