Open jmaglic opened 2 years ago
I tried to get started with OpenMP and I actually got it to work for a minimal example. However, I have reservations about putting in the time right now to implement it in our current code.
The problem is that OpenMP requires a dynamic library (libomp.dylib) to work. This means that distributing the software will either require the user to already have that file installed, or us to distribute the dylib together with the executable. Linking the library statically is not recommended.
In principle, I know how to do this on macOS. However, I have the feeling I will run into issues with backwards compatibility, because I'm already receiving these kinds of warnings:
ld: warning: dylib (/usr/local/lib/libomp.dylib) was built for newer macOS version (11.0) than being linked (10.11)
Even if I got it to work, it would mean that only the macOS version could take advantage of parallelisation. Not ideal. I suggest putting this on ice for now.
Current status
All computations are run through a single worker thread operating on a single CPU core. There is no parallelisation at all.
Issue
Certain sections could be parallelised, such as the algorithms that deal with voxel type assignment. Each voxel is evaluated effectively independently, so that would be an obvious place to implement parallelisation.
Proposed change
An option would be to use OpenMP to allow using multiple CPU cores at the same time.
Improvement
This change would improve the performance time of parallelised sections by up to a factor equal to the number of CPU cores.