Skip to content
Open
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
14 changes: 14 additions & 0 deletions tests/test_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ def rsqrt_workunit(tid: int, view: pk.View1D[pk.double]) -> None:
view[tid] = rsqrt(view[tid])


@pk.workunit
def fmin_workunit(tid: int, view: pk.View1D[pk.double]) -> None:
nan: pk.double = 1 / 0 - 1 / 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ... maybe testing against nan is not the best idea since it compares not equal to itself.
How about using the max/min val for double?

view[tid] = fmin(nan, view[tid])


@pk.workunit
def fmax_workunit(tid: int, view: pk.View1D[pk.double]) -> None:
nan: pk.double = 1 / 0 - 1 / 0
view[tid] = fmax(nan, view[tid])


@pytest.mark.parametrize(
"kokkos_workunit, numpy_ufunc",
[
Expand Down Expand Up @@ -145,6 +157,8 @@ def rsqrt_workunit(tid: int, view: pk.View1D[pk.double]) -> None:
np.reciprocal,
marks=pytest.mark.xfail(reason="see gh-27"),
),
(fmin_workunit, lambda x: np.fmin(np.nan, x)),
(fmax_workunit, lambda x: np.fmax(np.nan, x)),
],
)
def test_1d_unary_ufunc_vs_numpy(kokkos_workunit, numpy_ufunc):
Expand Down
Loading