devitocodes / notebooks

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Converted the stencil to a compiled function using autowrap #4

Closed navjotk closed 8 years ago

navjotk commented 8 years ago

On a smaller grid (14 x 14 x 14), the run time went from 231 seconds to 5 seconds because of this change.

The compiled function couldn't accept parameters as p(x,y,z) (as far as I understood the problem) so I had to make a variable for each array access. Sorry for dirtying up your code. Will work on beautifying the code again, however I want your feedback on whether its producing equivalent results. I compared the numerical output at the last time step and its the same (x,y) matrix.

This version doesn't contain any vectorisation. Further speedups should be expected once that is done.

Edit: The change suggested here uses the autowrap function to use a C-compiled version of the stencil function. The speedup observed after this change was measured on a reduced grid as described above.

mloubout commented 8 years ago

When you say a 14 x 14 x 14 grid, do you min you reduced the domain size (xmin, xmax..) or change the grid size(hstep). The grid size in the current setup (mine) is based on cfl condition. So modifying it would generate unstable or very dispersive wavefield which is very bad (Strong high frequency ripples will break the inversion) I will run it to see what it does and if it is still consistent enough with the wave equation

navjotk commented 8 years ago

I did not change the values in the committed code. I was reporting the grid size at which I compared the execution times. I reduced the domain only to be able to test faster since I was only tracking execution time while testing. The code here should have the same simulation parameters that you put in.

mloubout commented 8 years ago

I don;t have the right compilers to run your implementation, I am looking into it to see what I can do.

mloubout commented 8 years ago

@navjotk @mlange05 . I have lambdified with numy the stencils which changed the computation time from hours to seconds. It has the advantage to run without external librairies or compillers

navjotk commented 8 years ago

Closing for now. Can be re-evaluated when we are in a position to run better performance tests.