SciML / DiffEqGPU.jl

GPU-acceleration routines for DifferentialEquations.jl and the broader SciML scientific machine learning ecosystem
https://docs.sciml.ai/DiffEqGPU/stable/
MIT License
272 stars 27 forks source link

Support non-array parameter types #248

Closed pepijndevos closed 1 year ago

pepijndevos commented 1 year ago

We have a problem type that uses structs for parameters, which currently doesn't work with this package. This seems to be the offending line:

https://github.com/SciML/DiffEqGPU.jl/blob/dddcb594ce054c0677bc1b18fdabca2fc0c2eaa9/src/DiffEqGPU.jl#L675

What is this line attempting to do? I mean, what type that can be passed to Array but not hcat is it attempting to convert?

My proposed fix would be something like probs[i].p isa AbstractArray ? Array(probs[i].p) : probs[i].p but it's hard to judge if that would do the expected thing.

pepijndevos commented 1 year ago

Further down the line the broadcasting over the problem also seems to result in SubArrays of structs rather than structs, so the problem runs a bit deeper than this.

https://github.com/SciML/DiffEqGPU.jl/blob/b6177ed9a40d9a02b16c16c345d5e0df7d31a4e5/src/DiffEqGPU.jl#L24