OpenMP support in OSX 10.11, gcc errors with "file omp.h not found"

I am using gcc version 5.3.0. It says that it comes with openmp support. But every time I compile the program using either gcc [via the terminal] or through xCode 7, I get the same error, "omp.h file not found". I searched too much for this question and tried almost everything I found.

  • First I tried to find omp.h on my mac. I found several files; then in the header file I used this particular omp.h location but it didn’t help [it gave me a linker error].
  • I installed gcc version 6.0 (pre-release), but without help. I tried to change C_INCLUDE_PATH [which is now and earlier set to none], but that didn't help either.
  • I reinstalled clang-omp but didn't help.
  • I am using llvm version 7.0 compiler. Although I installed clang-omp, there is no omp.h in my / usr / include / *.
+1
source share
3 answers

I changed the compiler, and now I can run it. [This was a question about a klang that I could not solve]. I am a student and Intel gives Intel Parallel Studio a 1 year license for free for students . So I downloaded and installed it. In xCode, in the build settings, I installed my compiler in the “Intel C / C ++ compiler” and in parallelization, I turned it into “yes”. That's all. Then it compiled successfully. But note that you will no longer use the omp.h header file. By the way, I'm still looking for answers, just to find out what I'm doing wrong.

+2
source

You can install "clang-omp" or "gcc" (now corresponding to GCC 5.3) packages via Homebrew, both of which support OpenMP.

Built-in GCC is based on GCC 4.2.1 abs uses LLVM back end via Dragonegg, so it does not support OpenMP.

As already noted, Intel compilers support OpenMP on Mac.

I do not use the Xcode editor, so I do not know how to use any of them, but everything will work with the terminal in the same way as in Linux.

+1
source

The mac compiler is clang (based on llvm 3.5) which does not support openmp. you can try to install llvm / clang / openmp from the source or use prebuild binaries , but I have to admit that it does not work as advertised for me ... change if you do not use the -fopenmp=libomp .

0
source

Source: https://habr.com/ru/post/1270864/


All Articles