-
Notifications
You must be signed in to change notification settings - Fork 3
Numpy-fication vs. Sympy.ufuncify/autowrap #1
Description
Starting from the excellent symbolic description of the Acoustic wave equation provided by @mloubout we now want to speed-up the basic python version of the equation. However, since we are performing a stencil computation the traditional Numpy-fication tricks of applying operations over arrays become very wasteful in terms of memory, because we effectively need to to replicate the matrix for each stencil point. This is illustrated in the bottom figure of this page.
Fortunately, the problem of applying complex Sympy expressions to numeric systems is known and documented here. In particular the ufuncify functionality, or the even lower level autowrap module that provide some control of the JIT process, should allow us to turn the expression stencil in the acoustic wave equation notebook into a compiled function that can be applied to the numpy arrays that represent our grid. This should speed up the notebook computation significantly and give us insights into the necessary steps to generate the core computation kernels, as well as a baseline performance target that opesci-fd will aim to beat.