rivetTDA / rivet

RIVET is a tool for Topological Data Analysis, in particular two-parameter persistent homology.
GNU General Public License v3.0
73 stars 24 forks source link

Issues with build process for OpenMP on Mac OS #136

Open mlesnick opened 5 years ago

mlesnick commented 5 years ago

@davidt0x's recent changes (currently in a pull request) parallelize RIVET's minimal presentation computation using openMP.

This works perfectly on Ubuntu. However, the current CMakeLists.txt file and installation procedure for Mac OS X in the documentation do not build RIVET In a way that is compatible with OpenMP. This is not awful, since RIVET will still build properly for a single core, but of course it is something we want to fix.

This issue is related to the fact that Mac OS's version Clang does not come with OpenMP. One can install the OpenMP runtime library via homebrew using the command:

brew install libomp

However, it seems that to get RIVET to actually build with OpenMP using Mac OS's clang requires some finesse with CMake that we have not yet been able to manage.

The following links may give some hints about what needs to be done: https://stackoverflow.com/questions/44380459/is-openmp-available-in-high-sierra-llvm https://iscinumpy.gitlab.io/post/omp-on-high-sierra/ https://stackoverflow.com/questions/49738961/cmake-support-for-openmp-on-macos-high-sierra

Note in particular that in CMake 3.12.0, a patch is added to allow OpenMP and Clang to play nicely with each other. However, it seems that naively applying the patch is not sufficient.

@xoltar has pointed out that to circumvent this issue, you can install brew's version of llvm that has a clang with openmp, or else use g++. If this is the approach we wish to recommend to users (and I'm not sure that it is, since a solution using "brew install libomp" seems not too far off), then the install instructions should explain how to do this in detail.