Skip to content

Commit

Permalink
Merge pull request #826 from IntelPython/samaid_examples_refactor
Browse files Browse the repository at this point in the history
Add new kernel examples and restructure the existing kernel examples.
  • Loading branch information
diptorupd authored Dec 8, 2022
2 parents 1a54068 + aa52db8 commit 3cef533
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 350 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
conda activate numba_dpex_env
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
export OCL_ICD_FILENAMES=libintelocl.so
for script in $(find . \( -not -name "_*" -not -name "vectorize.py" -and -name "*.py" \))
for script in $(find . \( -not -name "_*" -not -name "vectorize.py" -not -name "scan.py" -and -name "*.py" \))
do
echo "Executing ${script}"
python ${script} || exit 1
Expand Down
52 changes: 0 additions & 52 deletions numba_dpex/examples/atomic_op.py

This file was deleted.

88 changes: 0 additions & 88 deletions numba_dpex/examples/barrier.py

This file was deleted.

102 changes: 0 additions & 102 deletions numba_dpex/examples/blacksholes_kernel.py

This file was deleted.

56 changes: 0 additions & 56 deletions numba_dpex/examples/dpex_func.py

This file was deleted.

51 changes: 0 additions & 51 deletions numba_dpex/examples/dpex_with_context.py

This file was deleted.

30 changes: 30 additions & 0 deletions numba_dpex/examples/kernel/atomic_op.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2020 - 2022 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

import dpnp as np

import numba_dpex as ndpex


@ndpex.kernel
def atomic_reduction(a):
idx = ndpex.get_global_id(0)
ndpex.atomic.add(a, 0, a[idx])


def main():
N = 10
a = np.arange(N)

print("Using device ...")
print(a.device)

atomic_reduction[N, ndpex.DEFAULT_LOCAL_SIZE](a)
print("Reduction sum =", a[0])

print("Done...")


if __name__ == "__main__":
main()
Loading

0 comments on commit 3cef533

Please sign in to comment.