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

AIBECS `F` is quite slower (5x) than handmade `F`

Open briochemc opened this issue 6 years ago • 1 comments

briochemc avatar May 14 '19 05:05 briochemc

Note to self: Actually it would be nice to be able to create a performant inplace F from the user input of sources and sinks. This might require some code transformation though, so I'm not sure how I would do this.

For example, the user could provide an expression for each term, like

  • uptake: -1 / τ * DIP^2 / (DIP + k) * (z ≤ zₑ)
  • remin: κ * POP
  • geores: (DIPgeo - DIP) / τgeo

and then AIBECS could build an inplace and fused-loop function

function G_DIP!(dDIP, DIP, POP, p)
   @unpack τ, k, zₑ, κ, DIPgeo, τgeo = p # unpack parameters
   dDIP .= @. -1 / τ * DIP^2 / (DIP + k) * (z ≤ zₑ) + κ * POP + (DIPgeo - DIP) / τgeo
end

briochemc avatar Aug 01 '19 11:08 briochemc