[Networkit] Clang with OpenMP

Matteo Riondato matteo at cs.brown.edu
Thu Nov 5 17:36:03 CET 2015

> On Nov 3, 2015, at 1:14 PM, Maximilian Vogel <maximilian.vogel at student.kit.edu> wrote:
> On 03.11.2015 19:01, Matteo Riondato wrote:
>> then clang (checking for version >= 3.7, which supports openmp)
>> Moreover, I sometimes test things with clang, just to be sure, and I have to modify the SConstruct script for every different choice.
> did You successfully compile NetworKit with clang 3.7?

Yes and No: there are a some compilation errors, but I disabled the parts of the code that fails (template issues in graph/RandomMaximumSpanningForest.cpp and graph/UnionMaximumSpanningForest.cpp) and that I don’t need. Apart from this, the main change I made was making the inclusion of the <parallel/algorithm> header in auxiliary/Parallel.h dependent on __clang__ not being defined (__GNU_C__ is defined for clang), and I redefined PI in Globals.h to be M_PI from <cmath>.

By the way, compiling with clang shows a bunch of interesting warnings that seems worth checking (e.g., there’s an if with an empty body).

My main issue with clang right now is that it doesn’t support user-defined openmp reductions, which I like and use.

> I tried it soon after it was released but I'm stuck with this error:
> networkit/cpp/Unittests-X.cpp:22:10: fatal error: 'omp.h' file not found
> #include <omp.h>
>         ^
> 1 error generated.
> Note: Clang is installed system wide and I changed the compile flag from -fopenmp to -fopenmp=libomp as stated in the release notes. Are there any other compile options to add/change or is my installation just broken?

You need to add -I<path_to_dir_containing_clang_omp.h> (look for a directory “libomp” in one of your standard include directories), and -L<path_to_dir_containing_clang_libomp.so> (look for a directory “libomp” in one of your standard lib directories).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20151105/83339386/attachment.sig>

More information about the NetworKit mailing list