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

test: add vectorize with target cuda test #3194

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
35 changes: 35 additions & 0 deletions tests-cuda/test_3191_numba_cuda_vectorize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from __future__ import annotations

import cupy as cp
import numba as nb

import awkward as ak

ak.numba.register_and_check()


@nb.vectorize()
def _square(x):
return x * x


@nb.vectorize(
target="cuda",
)
def _square_cuda(x):
return x * x


counts = cp.random.poisson(lam=3, size=50)
flat_values = cp.random.normal(size=int(counts.sum()))
values = ak.unflatten(flat_values, counts)


def test_square():
values2_cpu = _square(ak.to_backend(values, "cpu"))
print(values2_cpu)


def test_square_cuda():
values2 = _square_cuda(values)
print(values2)
Loading