Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 595610 - sys-devel/gcc: Support building against sys-libs/libomp
Summary: sys-devel/gcc: Support building against sys-libs/libomp
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-30 07:11 UTC by Michał Górny
Modified: 2018-06-23 23:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-09-30 07:11:13 UTC
I've been approached by Gentoo user who told me that he's been able to achieve superior performance when building OpenMP programs using gfortran against libomp (instead of libgomp). I'll link or attach his results when I get a confirmation that it's fine to do so.

However, doing that seems non-trivial. It seems that gcc strongly prefers files from /usr/lib/gcc..., so in order to enforce libomp we'd either have to replace libgomp.so or libgomp.spec. Does anyone have a better idea? Maybe it'd be possible to override openmp link libraries via Gentoo .spec files?
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2016-10-01 01:38:51 UTC
I thought that the openmp stuff in gcc was heavily tied to libgomp and other implementations weren't compatible (in that to use them you didn't pass -fopenmp but just linked in the wanted library, eg. intel's libiomp worked that way).  That was several years ago though so things may have changed?
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-01 06:46:14 UTC
I think you need -fopenmp to get the needed pragmas.

$ gfortran omptry.f90 -lomp
$ ./a.out 
 max threads:            0
  20000

$ gfortran omptry.f90 -fopenmp
$ ./a.out 
 max threads:            2
  20000

I could do '-fopenmp -lomp' but that links both libraries in, so probably not a good idea at all.

However, the following seems to work:

$ gfortran omptry.f90 -fopenmp -c
$ gfortran omptry.o -lomp
$ ./a.out 
 max threads:            2
  20000

However, it's a little inconvenient ;-).
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2018-06-23 20:20:07 UTC
(In reply to Michał Górny from comment #0)
> I've been approached by Gentoo user who told me that he's been able to
> achieve superior performance when building OpenMP programs using gfortran
> against libomp (instead of libgomp). I'll link or attach his results when I
> get a confirmation that it's fine to do so.

Any news here?

> 
> However, doing that seems non-trivial. It seems that gcc strongly prefers
> files from /usr/lib/gcc..., so in order to enforce libomp we'd either have
> to replace libgomp.so or libgomp.spec. Does anyone have a better idea? Maybe
> it'd be possible to override openmp link libraries via Gentoo .spec files?

No clue, but if it's worthwhile researching...
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-06-23 20:56:00 UTC
I don't really know.  I probably never got any reply, and I don't even really recall where to look for it.