Skip to content

Speed Up Mesh Conversion by Factor N

Simon Spannagel requested to merge mesh_concurrency into master

...where N is the hardware concurrency available.

This MR adds multithreading to the mesh converter tool by splitting up the x coordinate and placing the tasks for calculacting the individual slices on a task queue. The individual tasks return futures which are again assembled in the same order as requested, thus yielding the same result as a single-threaded calculation.

@kwolters unfortunately I had to reimplement a thread pool here as the other one is a bit too specific towards running on modules. If you have a better idea, let me know.

The only change with respect to the algorithm is the handling of index_cut. In the single-threaded version, the index cut was altered and never reset to its original value. Since this is not possible when splitting this up in different threads, now the initial value for index_cut is used for each of the individual tasks.

Apart from this, I have changed the file names to be more in line with the rest of the code base.

I have tested this with an electric field map I am currently working on and I was able to produce the exact same output mesh with the same input files and configuration, just much faster (here x4).

Edited by Simon Spannagel

Merge request reports