Skip to content

Internal API

cuNumeric.NDArray Type

The NDArray type represents a multi-dimensional array in cuNumeric. It is a wrapper around a Legate array and provides various methods for array manipulation and operations. Finalizer calls nda_destroy_array to clean up the underlying Legate array when the NDArray is garbage collected.

source
cuNumeric.LegateType Method
julia
LegateType(T::Type)

Internal API

Converts a Julia type T to the corresponding Legate type.

source
cuNumeric.compare Method
julia
compare(x, y, max_diff)

Internal API

Compare two arrays x and y for approximate equality within a maximum difference max_diff.

Supports comparisons between:

  • an NDArray and a Julia AbstractArray

  • two NDArrays

  • a Julia AbstractArray and an NDArray

Returns true if the arrays have the same shape and element type (for mixed types), and all corresponding elements differ by no more than max_diff.

Emits warnings when array sizes or element types differ.

Warning

This function uses scalar indexing and should not be used in production code. This is meant for testing.

Notes

  • This is an internal API used by higher-level approximate equality functions.

  • Does not support relative tolerance (rtol).

Behavior

  • Checks size compatibility.

  • Checks element type compatibility for NDArray vs Julia array.

  • Iterates over elements using CartesianIndices to compare element-wise difference.

source
cuNumeric.destroy! Method
julia
destroy!(arr::NDArray)

Eagerly drop the underlying cuPyNumeric/Legate handle and update allocation counters. Safe to call more than once.

source
cuNumeric.shape Method
julia
shape(arr::NDArray)

Internal API

Return the size of the given NDArray.

source
cuNumeric.slice_array Method
julia
slice_array(slices::Vararg{Tuple{Union{Int,Nothing},Union{Int,Nothing}},N}) where {N}

Internal API

Constructs a vector of cuNumeric.Slice objects from a variable number of (start, stop) tuples.

Each tuple corresponds to a dimension slice, using slice internally.

source
cuNumeric.to_cpp_index Method
julia
to_cpp_index(d::Int64, ::Type{T}=UInt64)

Internal API

Converts a single Julia 1-based index d to a zero-based C++ style index wrapped in StdVector.

source
cuNumeric.to_cpp_index Method
julia
to_cpp_index(idx::Dims{N}, ::Type{T}=UInt64) where {N}

Internal API

Converts a Julia 1-based index tuple idx to a zero-based C++ style index wrapped in StdVector of the specified integer type.

Each element of idx is decremented by 1 to adjust from Julia’s 1-based indexing to C++ 0-based indexing.

source