usnistgov / feasst

The Free Energy and Advanced Sampling Simulation Toolkit (FEASST) is a free, open-source, modular program to conduct molecular and particle-based simulations with flat-histogram Monte Carlo methods.
http://pages.nist.gov/feasst
Other
33 stars 13 forks source link

installation issue with Apple Silicon M1 Max [solved] #6

Closed mtap-research closed 1 year ago

mtap-research commented 2 years ago

I had trouble installing the software on Apple Silicon M1 Max with the following error msg.

[  0%] Building CXX object CMakeFiles/feasstthreads.dir/plugin/threads/src/thread_omp.cpp.o
/Users/lonestar/Desktop/codes/feasst/plugin/threads/src/thread_omp.cpp:2:12: fatal error: 'omp.h' file not found
  #include <omp.h>
           ^~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/feasstthreads.dir/plugin/threads/src/thread_omp.cpp.o] Error 1
make[1]: *** [CMakeFiles/feasstthreads.dir/all] Error 2
make: *** [all] Error 2

I had to install llvm from homebrew brew install llvm

Then

cmake -DCMAKE_C_COMPILER=/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang- DCMAKE_CXX_COMPILER=/opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang++ ..

After this, I was able to make -j4 to compile binaries, and run the simulation.

HaroldHatchNIST commented 2 years ago

Thank you very much for this helpful feedback. I am concerned why #ifdef _OPENMP did not handle this issue (https://github.com/usnistgov/feasst/blob/main/plugin/threads/src/thread_omp.cpp#L1-L3). Which version of clang did the Apple M1 have by default? I will update the troubleshooting install section in README.

mtap-research commented 2 years ago

Clang was from XCode and was installed at /usr/bin location.

Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Let me know if you need more information!

HaroldHatchNIST commented 2 years ago

Thanks! I reproduced the issue on a macbook. Commit https://github.com/usnistgov/feasst/commit/1d7f33b26bce4cfd0439eb5c65342e5177181316 in the develop branch enabled clang/openmp install with brew install libomp. It may also work with llvm. I hope this works on your machine and for @dwsideriusNIST.