torstai 20. helmikuuta 2014

Julia for finite elements, part 2

A small update to the previous post. I'm starting to approach the vectorized MATLAB speed. The new results are as follows.


(The highest DOF case was omitted in Julia because my crappy 'n slow 5-minute mesh refiner hogged all the memory.) Some tricks to speed up the code:

  • Devectorize, devectorize, devectorize, ... Write everything that you possibly can using loops. Even some simple matrix-vector-multiplications if you do them inside loops.
  • Do not use too much array slicing or anonymous functions (or reduntant function calls) inside loops. This will slow things down since function calls seem to have some overhead.
  • Preallocate arrays if possible. Otherwise use 1D arrays and push!-command.
I'm happy with the results of my test: Expect some Julia-sorcery in the future! The next target is parallelization.

Ei kommentteja:

Lähetä kommentti