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
2 changes: 1 addition & 1 deletion composability/integrals_optimization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ positive parameters without gradients; log parameters enforce positivity.
evaluation builds a backend concentration image, runs `Integrals.jl` on that
image for every band, and reduces the error to one scalar loss. The expensive
image arithmetic and integrals use `CuArray`, Dagger `DArray`, or `NDArray` storage. The scalar
loss reaches the optimizer through ordinary `allowautofetch` conversion; no
loss reaches the optimizer through ordinary `allowfetch` conversion; no
`all(isfinite, NDArray)` shim or `CNBool` conversion is defined.

The default single-GPU comparison is CUDA.jl, Dagger, and cuNumeric. Each backend
Expand Down
2 changes: 1 addition & 1 deletion composability/integrals_optimization/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ elseif backend == "cuNumeric"
make_state(a) = NDArray(a)
synchronized_time_ns() = cuNumeric.get_time_nanoseconds()
correct_storage(a) = a isa NDArray{T,2}
run_with_scalar_fetch(f) = cuNumeric.allowautofetch(f)
run_with_scalar_fetch(f) = cuNumeric.allowfetch(f)
elseif backend == "Dagger"
using Dagger, CUDA
const BLOCKS_PER_GPU = parse(Int, get(ENV, "DAGGER_BLOCKS_PER_GPU", "1"))
Expand Down
2 changes: 1 addition & 1 deletion composability/krylov/krylov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if BACKEND == "cuNumeric"
@eval make_operator(a::Matrix) = cuNumeric.nda_attach_external(a; shape=reverse(size(a)))
@eval sync(w) = cuNumeric.issue_execution_fence(; block=true)
@eval host_array(x) = Array(x)
@eval permitted_solve!(w, A, b) = @allowpromotion @allowautofetch solve!(w, A, b)
@eval permitted_solve!(w, A, b) = @allowpromotion @allowfetch solve!(w, A, b)
MODE == "local" && include("local.jl")
elseif BACKEND == "CuArray"
@eval using CUDA
Expand Down
2 changes: 1 addition & 1 deletion composability/ordinarydiffeq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ODE_ADAPTIVE=1 ODE_TIMED_SAMPLES=5 julia --project="$ODE_PROJECT" \
composability/ordinarydiffeq/integrator_smoke.jl 4096
```

The adaptive case scopes `cuNumeric.allowautofetch()` around `solve`, because
The adaptive case scopes `cuNumeric.allowfetch()` around `solve`, because
the step-size controller makes host-side scalar decisions. The timed benchmark
above continues to use the fixed-step CarpenterKennedy2N54 method.

Expand Down
2 changes: 1 addition & 1 deletion composability/ordinarydiffeq/integrator_smoke.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for (name, algorithm) in ALGORITHMS
)
# Adaptive controllers need host decisions; keep fetching scoped to solve.
permitted_solve() = if ADAPTIVE
cuNumeric.allowautofetch() do
cuNumeric.allowfetch() do
run_solve()
end
else
Expand Down
8 changes: 4 additions & 4 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ if CUNUMERIC_BENCH_RUNTIME
end

# Newer cuNumeric returns reductions as CNScalars, which unwrap to host values
# only inside allowautofetch. Older releases (e.g. 0.2) and other backends lack it.
const _AUTOFETCH = CUNUMERIC_BENCH_RUNTIME && isdefined(cuNumeric, :allowautofetch)
_with_autofetch(f) = _AUTOFETCH ? cuNumeric.allowautofetch(f) : f()
# only inside allowfetch. Older releases (e.g. 0.2) and other backends lack it.
const _ALLOWFETCH = CUNUMERIC_BENCH_RUNTIME && isdefined(cuNumeric, :allowfetch)
_with_fetch(f) = _ALLOWFETCH ? cuNumeric.allowfetch(f) : f()

_all_approx(a, b, ::Type{T}; kwargs...) where {T} = isapprox_ref(a, b, T; kwargs...)
function _all_approx(a::Tuple, b::Tuple, ::Type{T}; kwargs...) where {T}
Expand Down Expand Up @@ -258,7 +258,7 @@ function check_benchmark_correctness(
got = run_on(mod, check_problem)
reference_kernel = reference === Base ? check_problem : cuda_runnable(check_problem)
expected = run_on(reference, reference_kernel)
return _with_autofetch(() -> _all_approx(got, expected, T; atol, rtol)) ? "pass" : "fail"
return _with_fetch(() -> _all_approx(got, expected, T; atol, rtol)) ? "pass" : "fail"
end

# One timed trial: warmup, then time `n_iter` iterations of `run!`.
Expand Down
Loading