I have problems compiling OpenMP code using clang (both 3.6 and 3.8 ToT).
I followed this blog post http://blog.llvm.org/2015/05/openmp-support_22.html , but the problem is that the compiled program is executed on a one thread only. I'm using ubuntu 15.04 x64, I have both libgomp and libiopmp installed and I compile my code with the following command:
clang test.c -o test -fopenmp -L/usr/lib/gcc/x86_64-linux-gnu/5.1.1
When I use gcc instead, everything works fine: gcc test.c -o test -fopenmp
I also tried running export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5.1.1:$LD_LIBRARY_PATH
but it didn't help.
`
Any suggestions?
Some additional comments:
1) You need to use -fopenmp=libomp to enable OpenMP in clang. -fopenmp just links libgomp but ignores all the pragmas. Weird, I know -- and will be changed in the trunk soon.
2) 3.7 is the first version that supports OpenMP. 3.6 doesn't.
3) clang is only able to work with libomp. Don't put libgomp (headers or the library) in the way of libomp! clang uses Intel API, not supported by libgomp. -fopenmp=libomp should link correct library.