ericagol / NbodyGradient.jl

N-body integrator computes derivatives with respect to initial conditions for TTVs, RV, Photodynamics & more
MIT License
20 stars 9 forks source link

Speeding up Kepler+drift Jacobian propagation #43

Closed ericagol closed 3 years ago

ericagol commented 3 years ago

Right now we are spending a lot of time copying from the current Jacobian to a smaller matrix to use BLAS to multiply the kepler+drift Jacobian (jac_ij).

The BLAS routine seems to be faster than this!

So, it's not clear why the copying is so slow. It might be faster to simply insert the kepler+drift array into a full 7n x 7n Jacobian array and carry out the multiplication of the full matrix with BLAS. Not sure if sparse matrices can be used - the bodies which are not being touched will have the identity matrix for that sub-step.

Anyways, we need to see whether we can experiment with this and figure out how to speed it up.

To do:

ericagol commented 3 years ago

I tried this out for the outer solar system problem, and this added 67% to the run time. So, the BLAS multiplications are taking significant time, and it does pay to copy back and forth.