Open mrava87 opened 5 years ago
Done for Spread operator (forward and adjoint). Follow that structure for future operator optimization
Is this still a goal for some of the other operators?
Yes, as long as they show performance improvements over pure NumPy ones this is always welcome.
@AhmedA1559, do you have something specific in mind?
Yes, as long as they show performance improvements over pure NumPy ones this is always welcome.
@AhmedA1559, do you have something specific in mind?
Yes. I was thinking of implementing Numba decorators for some of the dunder methods in the LinearOperator base class at first, if they yielded performance benefits with it.
Sounds good. My reccomandation is that anything that simply calls NumPy/Scipy routines will likely not yield much benefit. In cases where writing a for...loop is the only way to go, then Numba may help.
Please make sure to always compare pre and after Numba decoration as we will only accept to include changes where the performance gain is evident :)
@mrava87 do we still need to add this? I would like to work on this if it is still relevant.
Yes, still relevant. Read the comments above and do some digging of what methods you think may benefit from adding Numba decorators (which likely means you need to reimplement the matvec/rmatvec in a form that is Numba friendly more than Numpy friendly - eg with numpy you want to avoid for..loops
as much as possible, with Numba you want them to allow Numba to parallelize if you use prange...)
Some of the main linear operators may get a speed-up by simply adding
numba <http://numba.pydata.org>
_@jit
decorators to_matvec
and_rmatvec
methods.Others, such as
FirstDerivative
may be suited to stencil decorator.Note: it may be enough to simply add
numba
to dependencies as it is a fairly common library but to keep dependencies to a minimum it may be better to implement private functions such as_matvec_serial
and_matvec_numba
and try importingnumba
, always falling back to by_matvec_serial
if that is not available in the python environment of the user.