Clang OpenMP Benchmarks On Linux 64-bit Against GCC
Written by Michael Larabel in Software on 3 September 2015. Page 1 of 2. 9 Comments

A few days ago I posted some LLVM Clang 3.7 vs. GCC compiler benchmarks on Linux in time for the release of LLVM 3.7. While LLVM/Clang 3.7 brings full support for OpenMP 3.1, OMP tests were omitted from the original article due to running into some issues. In this article are some reference tests for Clang OpenMP performance with the latest mainline SVN code compared to GCC.

LLVM Clang 3.7 having OpenMP support is one of many exciting features with Clang sorely missing out on this important specification for parallel programming that's popular within the scientific area and other communities for leveraging their workload against multiple CPU cores. Previous to the recent mainlining of the support, Intel and others had been maintaining an out-of-tree branch with the OpenMP support. My last tests of that Intel Clang OpenMP code ( were last year. Aside from OpenMP 3.1, the Clang code-base currently has limited support for OpenMP 4.

Since the Clang 3.7 benchmarking article earlier in the week, I switched over to the latest LLVM Clang trunk SVN code to see if there were problems there with OpenMP. I still was running into problems even with having the proper OpenMP library installed, communicating with one of the developers, etc. Then yesterday while debugging the issue with a simple OpenMP hello world program, I discovered something odd: if -fno-exceptions is set as a compiler flag alongside the -fopenmp=libomp, the OpenMP support works! Developer Jonas Hahnfeld mentioned that -fno-exceptions shouldn't be required for working OpenMP support, but for whatever the case is with this particular Ubuntu Linux x86_64 system, that's the only way I could make the code happy. For those that haven't seen the Clang 3.7 release notes yet or tried for yourself, for now, -fopenmp=libomp has to be set rather than just "-fopenmp" as is common to the make files for many applications mostly focused on GCC support. Hopefully soon the default behavior will be cleared up to work just fine with -fopenmp on Clang to provide better out-of-the-box support for the vast array of existing open-source OpenMP programs.

So anyhow, with the -fno-exceptions trick, I then set out to run a few reference benchmarks of LLVN Clang 3.8 SVN against GCC 4.9 and GCC 5.2.0. GCC 4.9.2 was from the Ubuntu 15.04 archive while I had built GCC 5.2.0 in a release mode. The build of LLVM Clang 3.8.0 SVN was also in a release/optimized mode. With LLVM Clang 3.8 SVN I did one run without setting any extra CFLAGS/CXXFLAGS while the second run for the OpenMP results had appended the "-fno-exceptions -fopenmp=libomp" to look squarely at the OpenMP performance. All of these compiler benchmarks were conducted via the open-source Phoronix Test Suite benchmarking software.

Related Articles
Trending Linux News