Skip to content

Support numpy.isnan and numpy.isnat in cuda.jit kernels #4333

Description

@kkraus14

Currently math.isnan is supported for checking for NaNs, but there's no way to check for NaTs easily short of viewing as an int64 and comparing to the minimum value (-9223372036854775808). Simple reproducer:

import numpy as np
from numba import cuda

test_in = cuda.to_device(np.array([1,None,3], dtype='datetime64[ms]'))
test_out = cuda.to_device(np.array([1,2,3]))

@cuda.jit
def test_datetime_nat(in_array, out_array):
    i = cuda.grid(1)
    if i < in_array.size:
        if np.isnat(in_array[i]):
            out_array[i] = 100

test_datetime_nat.forall(test_in.size)(test_in, test_out)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions