NiMARE icon indicating copy to clipboard operation
NiMARE copied to clipboard

Optimize Correctors with numba

Open adelavega opened this issue 2 years ago • 2 comments

Looking into optimizing performance of correctors using numba or by minimizing OOP overhead in the repeated numerical computations

adelavega avatar Apr 26 '22 16:04 adelavega

Numba can optimize numerical computations but is not OOP aware or Pandas aware. Must be pure numpy/basic types to see most gains.

It's possible we can extend Numba for sparse arrays if we end up using them: https://www.quansight.com/post/extending-numba-types-for-clean-fast-code

It also looks like a lot of the overhead may be just Python OOP related, as a lot of logic get repeated within each iteration.

adelavega avatar Apr 26 '22 16:04 adelavega

Perhaps we can expose the MA map generation function within the KernelTransformer, so that the correction procedure can call that directly instead of KernelTransformer.transform(). As long as the underlying function operates only on numpy arrays, it could work with numba. I assume the MA map generation is the biggest bottleneck for the correction procedure.

tsalo avatar May 04 '22 14:05 tsalo