mattjj / pyhsmm

MIT License
547 stars 173 forks source link

Mavericks and "-fopenmp" error #17

Closed marcel12bell closed 10 years ago

marcel12bell commented 10 years ago

Installation gives me this compiler error: clang++ -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.9-x86_64-2.7/internals/hmm_messages_interface.o -o build/lib.macosx-10.9-x86_64-2.7/internals/hmm_messages_interface.so -fopenmp ld: library not found for -lgomp clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang++' failed with exit status 1

I think it's related to mavericks incompatibility with openmp. After deactivating "-fopenmp" flag it worked... Is there a better solution?

mattjj commented 10 years ago

Clang doesn't support OpenMP yet (on any OS), though there are some plans and a fork. To use OpenMP features in any build (pyhsmm included) you'll need to compile with g++ (or Intel's icc if you have a license for it). I use g++ 4.8 on my Mac, and g++ tends to produce faster binaries than Clang anyway.

At the moment the Python model interface can't call the OpenMP-accelerated code (I haven't merged that stuff yet), so you're not missing out on anything. There are other (also un-merged) higher-level ways to parallelize things in pyhsmm, including joblib and IPython parallel (which can run across multiple machines), but since those incur process- and GIL-related overhead, OpenMP is a clear win when one needs to compute with lots of small observation sequences.