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
4 changes: 2 additions & 2 deletions .buildkite/developer.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ steps:
LD_LIBRARY_PATH: ""
LEGATE_AUTO_CONFIG: "0"
LEGATE_SHOW_CONFIG: "1"
GPUTESTS: "1"
LEGATE_TEST: "1"
LEGATE_CONFIG: "--cpus 1 --gpus 1 --utility 1 --fbmem 500 --logging legate=info,level=2 --log-to-file 1"
LEGATE_SKIP_RUNTIME: "true"
LEGATE_CONFIG: "--cpus 1 --gpus 1 --utility 1 --fbmem 250 --logging legate=info,level=2 --log-to-file 1"
CUNUMERIC_FUSION: "{{matrix.fusion}}"
matrix:
setup:
Expand Down
5 changes: 3 additions & 2 deletions .buildkite/jll.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ steps:
fi
julia --project -e 'using Pkg; Pkg.resolve(); Pkg.instantiate()'
- JuliaCI/julia-test#v1:
test_args: "--quickfail"
test_args: "--quickfail --jobs=8 --verbose"
- JuliaCI/julia-coverage#v1:
dirs:
- src
Expand All @@ -42,7 +42,8 @@ steps:
LEGATE_SHOW_CONFIG: "1"
GPUTESTS: "1"
LEGATE_TEST: "1"
LEGATE_CONFIG: "--cpus 1 --gpus 1 --utility 1 --fbmem 500 --logging legate=info,level=2 --log-to-file 1"
LEGATE_SKIP_RUNTIME: "true"
LEGATE_CONFIG: "--cpus 1 --gpus 1 --utility 1 --fbmem 250 --logging legate=info,level=2 --log-to-file 1"
matrix:
setup:
julia:
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/run_developer_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ cp LocalPreferences.toml test/LocalPreferences.toml

julia --color=yes --project=. -e '
using Pkg
Pkg.test("cuNumeric"; test_args = ["--quickfail"])
Pkg.test("cuNumeric"; test_args = ["--quickfail", "--jobs=8", "--verbose"])
'
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ jobs:

- name: Run tests
env:
GPUTESTS: "0" # parsed by runtests.jl
LEGATE_SHOW_CONFIG: "1"
LEGATE_AUTO_CONFIG: "0"
LEGATE_CONFIG: "--cpus 1 --utility 1 --sysmem 4000"
run: julia --project -e 'using Pkg; Pkg.test(test_args=["--quickfail"])'
LEGATE_SKIP_RUNTIME: "true"
LEGATE_CONFIG: "--cpus 1 --utility 1 --sysmem 500"
run: julia --project -e 'using Pkg; Pkg.test(test_args=["--quickfail", "--jobs=2", "--verbose"])'
4 changes: 2 additions & 2 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ jobs:
# Develop into the workspace root so its members (incl. dev/) resolve to the override.
- name: Build and test cuNumeric (developer mode)
env:
GPUTESTS: "0"
LEGATE_CHECKOUT: /tmp/Legate.jl
LEGATE_SKIP_RUNTIME: "true"
run: |
rm -f Manifest.toml test/Manifest.toml dev/Manifest.toml \
LocalPreferences.toml test/LocalPreferences.toml
Expand Down Expand Up @@ -157,4 +157,4 @@ jobs:

cp LocalPreferences.toml test/LocalPreferences.toml

julia --color=yes --project=. -e 'using Pkg; Pkg.test("cuNumeric")'
julia --color=yes --project=. -e 'using Pkg; Pkg.test("cuNumeric"; test_args=["--quickfail", "--jobs=2", "--verbose"])'
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function build_cpp_wrapper(
)
@info "libcunumeric_jl_wrapper: Building C++ Wrapper Library"
isdir(install_root) && (rm(install_root; recursive=true); mkdir(install_root))
bld_command = `$(joinpath(repo_root, "scripts/build_cpp_wrapper.sh")) $repo_root $cupynumeric_loc $legate_loc $blas_loc $install_root $(Threads.nthreads())`
bld_command = `$(joinpath(repo_root, "scripts/build_cpp_wrapper.sh")) $repo_root $cupynumeric_loc $legate_loc $blas_loc $install_root 8`
return BuildTools.run_build_wrapper_script(
repo_root, bld_command; cuda_root, cuda_enabled, log_dir=@__DIR__
)
Expand Down
2 changes: 2 additions & 0 deletions src/cuNumeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ function __init__()
# to register packages. So we will just skip starting
# legate/cunumeric when using registry CI machines.
get(ENV, "JULIA_REGISTRYCI_AUTOMERGE", false) == "true" && return nothing
# skip runtime here as well
get(ENV, "LEGATE_SKIP_RUNTIME", false) == "true" && return nothing

# Start runtime, but only if not pre-compiling
ensure_runtime!()
Expand Down
3 changes: 3 additions & 0 deletions src/utilities/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ function versioninfo(io::IO=stdout)
Legate Auto Config: $is_auto_config
Legate Config: $legate_config

Brodcast Fusion: $(FUSE_BROADCAST_EXPRS)
Brodcast Min Ops: $(FUSE_BROADCAST_MIN_OPS)

Hostname: $hostname
Julia Version: $(VERSION)
C++ Compiler: $compiler
Expand Down
3 changes: 3 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
CNPreferences = "3e078157-ea10-49d5-bf32-908f777cd46f"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDA_Driver_jll = "4ee394cb-3365-5eb0-8335-949819d2adfc"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions test/analysis/promotion.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@testset "Type and Shape Promotion" begin
N = 100
cunumeric_arr1 = cuNumeric.zeros(Float64, N)
cunumeric_arr3 = cuNumeric.zeros(Float32, N)
cunumeric_int64 = cuNumeric.zeros(Int64, N)
cunumeric_int32 = cuNumeric.zeros(Int32, N)
cunumeric_arr5 = cuNumeric.zeros(Float64, N - 1, N - 1)
@test_throws "Implicit promotion" cunumeric_arr3 .+ cunumeric_arr1
@test_throws "Implicit promotion" map(+, cunumeric_arr3, cunumeric_arr1)
@test_throws DimensionMismatch cunumeric_arr1 .+ cunumeric_arr5
@test_throws DimensionMismatch cunumeric_arr1 ./ cunumeric_arr5

allowscalar() do
@test safe_compare(
cunumeric_arr1, cunumeric_int64 .+ cunumeric_arr1, atol(Float64), rtol(Float64)
)
r1 = @allowpromotion cunumeric_arr3 .+ cunumeric_arr1
r2 = @allowpromotion map(+, cunumeric_arr3, cunumeric_arr1)
@test safe_compare(r1, r2, atol(Float64), rtol(Float64))
end
end
File renamed without changes.
40 changes: 38 additions & 2 deletions test/tests/axpy_advanced.jl → test/array/axpy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function axpy_advanced(T, N)
α = T(56.6)

# base Julia arrays
x_cpu = Base.zeros(T, dims);
y_cpu = Base.zeros(T, dims);
x_cpu = Base.zeros(T, dims)
y_cpu = Base.zeros(T, dims)

# cunumeric arrays
x = cuNumeric.zeros(T, dims)
Expand Down Expand Up @@ -113,3 +113,39 @@ function axpy_advanced(T, N)
@test safe_compare(result_cpu, result, atol(T), rtol(T))
end
end

function axpy_basic(T, N)
α = T(56.6)
dims = (N, N)

# Base julia arrays
x_cpu = rand(T, dims)
y_cpu = rand(T, dims)

# cunumeric arrays
x = cuNumeric.zeros(T, dims)
y = cuNumeric.zeros(T, dims)

# Initialize NDArrays with same random values as julia arrays
@allowscalar for i in 1:N
for j in 1:N
x[i, j] = x_cpu[i, j]
y[i, j] = y_cpu[i, j]
end
end

result = α .* x .+ y
result_cpu = α .* x_cpu .+ y_cpu
allowscalar() do
@test safe_compare(result, result_cpu, atol(T), rtol(T))
@test safe_compare(result_cpu, result, atol(T), rtol(T))
end
end

@testset "AXPY" begin
N = 100
@testset verbose = true for T in Base.uniontypes(cuNumeric.SUPPORTED_FLOAT_TYPES)
@testset "basic" axpy_basic(T, N)
@testset "advanced" axpy_advanced(T, N)
end
end
27 changes: 27 additions & 0 deletions test/array/binary/float.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#= Copyright 2026 Northwestern University,
* Carnegie Mellon University University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author(s): David Krasowska <krasow@u.northwestern.edu>
* Ethan Meitz <emeitz@andrew.cmu.edu>
=#

include(joinpath(@__DIR__, "tests.jl"))

run_binary_ops_tests(
filter(
T -> T <: AbstractFloat || T <: Complex,
Base.uniontypes(cuNumeric.SUPPORTED_ARRAY_TYPES),
),
)
28 changes: 28 additions & 0 deletions test/array/binary/int.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#= Copyright 2026 Northwestern University,
* Carnegie Mellon University University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author(s): David Krasowska <krasow@u.northwestern.edu>
* Ethan Meitz <emeitz@andrew.cmu.edu>
=#

include(joinpath(@__DIR__, "tests.jl"))

run_binary_ops_tests(
filter(
T -> T === Bool || T <: Signed,
Base.uniontypes(cuNumeric.SUPPORTED_ARRAY_TYPES),
),
)
run_binary_copyto_tests()
111 changes: 111 additions & 0 deletions test/array/binary/powers.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#= Copyright 2026 Northwestern University,
* Carnegie Mellon University University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author(s): David Krasowska <krasow@u.northwestern.edu>
* Ethan Meitz <emeitz@andrew.cmu.edu>
=#

@testset "Powers" begin
N = 9

get_pwrs(::Type{I}) where {I<:Integer} = I.([-10, -5, -2, -1, 0, 1, 2, 5, 10])
get_pwrs(::Type{F}) where {F<:AbstractFloat} = F.([-3.141, -2, -1, 0, 1, 2, 3.2, 4.41, 6.233])
get_pwrs(::Type{Bool}) = [true, false, true, false, false, true, false, true, true]

# TYPES = Base.uniontypes(cuNumeric.SUPPORTED_ARRAY_TYPES)
TYPES = Base.uniontypes(cuNumeric.SUPPORTED_FLOAT_TYPES)

@testset "$(BT) ^ $(PT)" for (BT, PT) in Iterators.product(TYPES, TYPES)
base_jl = my_rand(BT, N)

if BT <: Union{Bool,Int32} && PT == Int32
# julia doesnt like Int32 powers
pwrs = Float32.(get_pwrs(PT))
elseif BT <: Union{Bool,Int32,Int64} && PT <: Union{Int32,Int64}
# julia doesnt like Int64 powers on bool
pwrs = Float64.(get_pwrs(PT))
elseif (PT <: AbstractFloat) && (BT <: AbstractFloat || BT <: Signed)
# Things like -387 ^ 3.2 will be Complex and error
pwrs = get_pwrs(PT)
base_jl = abs.(base_jl)
else
pwrs = get_pwrs(PT)
end

base_cn = @allowscalar NDArray(base_jl)
pwrs_cn = @allowscalar NDArray(pwrs)

# we deviate a bit form Julia here
if (PT <: Union{Int32,Int64}) && (BT <: Union{Bool,Int32,Int64})
T_OUT = cuNumeric.__my_promote_type(typeof(^), BT, PT)
else
T_OUT = Base.promote_op(Base.:(^), BT, PT)
end

TEST_BROKEN = (BT <: Union{Int32,Int64} && PT == Bool)

allowpromotion(true) do
allowscalar() do
# Power is array
@test safe_compare(
base_jl .^ pwrs, base_cn .^ pwrs_cn, atol(T_OUT), rtol(T_OUT)
) skip=TEST_BROKEN

# Power is scalar
for p in pwrs
@test safe_compare(base_jl .^ p, base_cn .^ p, atol(T_OUT), rtol(T_OUT))
end
end
end
end

@testset verbose = true "Reciprocal" begin
@testset for T in TYPES
arr_jl = Random.rand(T, N)
arr_cn = @allowscalar NDArray(arr_jl)

# Differ from Julia here
T_OUT = cuNumeric.__recip_type(T)

# Cast julia result to whatever we do
res_jl = T_OUT.(arr_jl .^ -1)
allowpromotion(true) do
res_cn = arr_cn .^ -1
res_cn2 = inv.(arr_cn)
allowscalar() do
@test safe_compare(res_jl, res_cn, atol(T_OUT), rtol(T_OUT))
@test safe_compare(res_jl, res_cn2, atol(T_OUT), rtol(T_OUT))
end
end
end
end

@testset verbose = true "Square" begin
@testset for T in TYPES
arr_jl = Random.rand(T, N)
arr_cn = @allowscalar NDArray(arr_jl)

T_OUT = Base.promote_op(Base.:(^), T, Int64)
res_jl = arr_jl .^ 2
res_cn = arr_cn .^ 2

allowpromotion(true) do
allowscalar() do
@test safe_compare(res_jl, res_cn, atol(T_OUT), rtol(T_OUT))
end
end
end
end
end
Loading
Loading