Skip to content

Commit 3cef533

Browse files
author
Diptorup Deb
authored
Merge pull request #826 from IntelPython/samaid_examples_refactor
Add new kernel examples and restructure the existing kernel examples.
2 parents 1a54068 + aa52db8 commit 3cef533

File tree

12 files changed

+437
-350
lines changed

12 files changed

+437
-350
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
conda activate numba_dpex_env
153153
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
154154
export OCL_ICD_FILENAMES=libintelocl.so
155-
for script in $(find . \( -not -name "_*" -not -name "vectorize.py" -and -name "*.py" \))
155+
for script in $(find . \( -not -name "_*" -not -name "vectorize.py" -not -name "scan.py" -and -name "*.py" \))
156156
do
157157
echo "Executing ${script}"
158158
python ${script} || exit 1

numba_dpex/examples/atomic_op.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

numba_dpex/examples/barrier.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

numba_dpex/examples/blacksholes_kernel.py

Lines changed: 0 additions & 102 deletions
This file was deleted.

numba_dpex/examples/dpex_func.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

numba_dpex/examples/dpex_with_context.py

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-FileCopyrightText: 2020 - 2022 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
import dpnp as np
6+
7+
import numba_dpex as ndpex
8+
9+
10+
@ndpex.kernel
11+
def atomic_reduction(a):
12+
idx = ndpex.get_global_id(0)
13+
ndpex.atomic.add(a, 0, a[idx])
14+
15+
16+
def main():
17+
N = 10
18+
a = np.arange(N)
19+
20+
print("Using device ...")
21+
print(a.device)
22+
23+
atomic_reduction[N, ndpex.DEFAULT_LOCAL_SIZE](a)
24+
print("Reduction sum =", a[0])
25+
26+
print("Done...")
27+
28+
29+
if __name__ == "__main__":
30+
main()

0 commit comments

Comments
 (0)