FiniteDiff.jl icon indicating copy to clipboard operation
FiniteDiff.jl copied to clipboard

Remove `allowed_getindex` when possible, for faster GPU operations

Open albertomercurio opened this issue 3 years ago • 1 comments

Hello,

I'm able to use this package with CUDA Arrays, since the allowed_getindex (for example used here) does not handle the indexing error of the CuArrays. However this slow down the computation, since this process would be transfered and than executed on the CPU.

Is it possible, for example in that for loop I linked, to avoid using the allowed_getindex function? It would be a very good improvement, not only for GPU calculations.

albertomercurio avatar Sep 28 '22 23:09 albertomercurio

I mean, it would make it faster to remove it, but it would also make it incorrect. Do you have an idea for how to do it with also keeping the correctness? You do have to somehow change the value by epsilon and put it back, and that will require a kernel call each time.

Also for the allowed_getindex handling, did you follow https://github.com/JuliaDiff/FiniteDiff.jl#note-about-sparse-differentiation-of-gpuarrays-bandedmatrices-and-blockbandedmatrices ?

ChrisRackauckas avatar Sep 29 '22 05:09 ChrisRackauckas