How can I use libiomp5.so with gcc linked application where I want to use the parallel version of std, i.e. __gnu_parallel::sort. I tried to just link with libiomp5.so and that does not work. I tried to -D_GLIBCXX_PARALLEL and link the iomp lib to no avail. If I add -fopenmp then gcc links in libgomp which is not  what I want.



3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Try adding libiomp5.so to command line, like:
    gcc -fopenmp libiomp5.so

Or to be sure libgomp is not used you can remove unneeded libraries from application dependencies:
    gcc -fopenmp libiomp5.so -Wl,--as-needed



Thanks. I think that gets me to where I want to be. I also decided to give tbb::parallel_sort a go (given that I am already linking in tbb) and that is probably my best option because then I only have one thread pool. However, the main think was to get rid of libgomp from the link because it is GPL-3 which is find unless you are shipping the transitive closure of your software (and unlike libstdc++, there is no exception for it).

Leave a Comment

Please sign in to add a comment. Not a member? Join today