Skip to content
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
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "cuNumeric"
uuid = "0fd9ffd4-7e84-4cd0-b8f8-645bd8c73620"
version = "0.1.1"
version = "0.2.0"

[deps]
CNPreferences = "3e078157-ea10-49d5-bf32-908f777cd46f"
Expand Down Expand Up @@ -32,16 +32,16 @@ CxxWrap = "0.17"
ExpressionExplorer = "1.1.4"
JuliaFormatter = "2.3.0"
KernelAbstractions = "0.9.41"
Legate = "0.1.2"
Legate = "0.2.0"
LegatePreferences = "0.1.6"
MacroTools = "0.5.16"
OpenBLAS32_jll = "0.3"
Pkg = "1"
Preferences = "1"
Random = "1"
StatsBase = "0.34"
cunumeric_jl_wrapper_jll = "25.10.3"
cupynumeric_jll = "25.10.3"
cunumeric_jl_wrapper_jll = "26.1.0"
cupynumeric_jll = "26.1.0"
julia = "1.10"

[workspace]
Expand Down
4 changes: 2 additions & 2 deletions deps/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* Ethan Meitz <emeitz@andrew.cmu.edu>
=#

const MIN_CUNUMERIC_VERSION = v"25.10.00"
const MAX_CUNUMERIC_VERSION = v"25.12.00"
const MIN_CUNUMERIC_VERSION = v"26.06.00"
const MAX_CUNUMERIC_VERSION = v"26.11.999"

up_dir(dir::String) = abspath(joinpath(dir, ".."))

Expand Down
4 changes: 2 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[compat]
CNPreferences = "0.1.2"
CNPreferences = "0.1.3"
Documenter = "1.5"
cuNumeric = "0.1"
cuNumeric = "0.2.0"

[deps]
CNPreferences = "3e078157-ea10-49d5-bf32-908f777cd46f"
Expand Down
2 changes: 1 addition & 1 deletion lib/CNPreferences/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ LegatePreferences = "8028f36a-2b64-49e9-aa04-2d0933fd2ed9"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"

[compat]
LegatePreferences = "0.1.5"
LegatePreferences = "0.1.6"
Preferences = "1.4.3"
julia = "1.10"
20 changes: 14 additions & 6 deletions src/ndarray/ndarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,21 @@ function (::Type{<:Array{A}})(arr::NDArray{B,1}) where {A,B}
return make_array(A, Ptr{A}(get_ptr(arr)), size(arr))
end

# TODO: query the store's DimOrdering instead of assuming row-major (C-order).
# Julia Arrays are column-major, so for C-ordered buffers we transpose, wrap,
# then transpose back so `Array(nda)` matches `nda[i,j]`.
# Copy logically into Julia's column-major storage.
# Legate may map an NDArray in C or Fortran order.
function _copy_to_julia_array(arr::NDArray{T,N}) where {T,N}
out = Array{T}(undef, size(arr))
store = Legate.attach_external_col_major(out)
ptr = cuNumeric.nda_store_to_ndarray(store.handle)
finalize(store.handle)
attached = NDArray(ptr, T, Val(N), out)
copyto!(attached, arr)
get_ptr(attached) # Block until the copy into `out` completes.
return out
end

function (::Type{<:Array{A}})(arr::NDArray{B}) where {A,B}
t = transpose(arr)
w = make_array(B, Ptr{B}(get_ptr(t)), size(t))
out = collect(permutedims(w, reverse(1:ndims(w))))
out = _copy_to_julia_array(arr)
return A === B ? out : copyto!(Array{A}(undef, size(arr)), out)
end

Expand Down
6 changes: 6 additions & 0 deletions src/ndarray/unary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ function Base.any(input::NDArray{Bool}; dims=Colon())
return _bool_reduction_impl(cuNumeric.ANY, input, dims)
end

# Boolean multiplication is logical conjunction. cuPyNumeric's PROD reduction
# uses a numeric fill identity, which Legate rejects for a Boolean target.
function Base.prod(input::NDArray{Bool}; dims=Colon())
return _unary_reduction_impl(Base.prod, cuNumeric.ALL, input, dims)
end

#! ONLY ADD ONCE REDUCTIONS RETURN A SCALAR
# function StatsBase.mean(arr::NDArray{T}) where T
# return sum(arr) ./ prod(size(arr))
Expand Down
Loading