ExponentialUtilities.jl
ExponentialUtilities.jl copied to clipboard
GPU-Friendly `inplace_add!`
inplace_add!
as currently implemented uses scalar indexing to update the diagonal of an array. Since CuArray
s disallow scalar indexing outside the REPL, this method breaks in practice.
The current implementation, reproduced from here
@inline function inplace_add!(A,B::UniformScaling) # Called from generated code
s = B.λ
@inbounds for i in diagind(A)
A[i] += s
end
end
Thanks for the report. Indeed, one thing we really need to get up and running on this repo is GPU tests.
I think this might be the only ExponentialUtilities.jl
change needed.
https://github.com/JuliaGPU/CUDA.jl/pull/1532 solves the ldiv!
with LU decomposition
We also need LinearAlgebra.opnorm1(::CuMatrix)
which is straightforward to get something that works, but not obvious to me how to get something that's low/non-allocating
For diagonal, we do this in diffeq: https://github.com/SciML/OrdinaryDiffEq.jl/blob/v6.14.0/src/derivative_utils.jl#L447-L457
@YingboMa might have ideas for opnorm1.