Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel examples refactoring #826

Merged
merged 7 commits into from
Dec 8, 2022
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 .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