Speedup .cube generation by ~260x

What has been done:

  • write_vector_to_cube_visualization routine has been changed to write to a buffer instead of directly to the output file. This gains about a factor 10 in speed compared to the current version.
  • For some reason, using the fortran write statement is still very slow compared to the C function sprintf. Making a small wrapper to use sprintf instead gived a huge speedup.
  • Additionally using sprintf makes the code omp parallelizable. For some reason adding omp to the loop using write makes it slower.
  • In total, a small test I ran that took development 228 seconds to produce the .cube file, takes 0.88 seconds with this version.

ToDo-list

The boxes below need to be checked before merge review will start

  • Testing
    • All tests pass -rcheck flag enabled in setup.py
    • All tests pass -fbatch flag enabled in setup.py
  • Versioning
    • Changelog.md is up to date
    • If merge into master: The patch number in parameters.F90 and changelog.md is up to date
  • Website (Needs to be done before merge)
    • Updates (if any) to the website have been added
  • Compliance with style guide
Edited by Marcus Takvam Lexander

Merge request reports

Loading