Bug 1409871 - [RFE] enable openmp support
Summary: [RFE] enable openmp support
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dave Airlie
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1451138
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-03 16:50 UTC by Satish Balay
Modified: 2018-01-20 17:06 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-01-18 17:25:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Satish Balay 2017-01-03 16:50:22 UTC
Description of problem:

Currently OpenMP is not enabled in fedora clang

Version-Release number of selected component (if applicable):

clang-3.8.0-2.fc25.x86_64
[currently using F25 - but filed it against rawhide - as this is a RFE]

How reproducible:
always

Steps to Reproduce:
1. wget https://computing.llnl.gov/tutorials/openMP/samples/C/omp_hello.c
2. /usr/bin/clang -fopenmp omp_hello.c
3.

Actual results:

omp_hello.c:13:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^
1 error generated.


Expected results:

openmp compile

Additional info:

http://openmp.llvm.org/ says:

"With the release of Clang 3.8.0, OpenMP 3.1 support is enabled in Clang by default, and the OpenMP runtime is therefore built as a normal part of the Clang build, and distributed with the binary distributions.You do not, therefore, need explicitly to check out this code, or build it out of tree; a normal Clang check out and build will automatically include building these runtime libraries."

But somehow its not enabled in fedora clang build?

A prebuilt binary from http://releases.llvm.org/download.html#3.9.0 does work.

$ /home/balay/soft/clang+llvm-3.9.0-x86_64-fedora23/bin/clang --version
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/balay/soft/clang+llvm-3.9.0-x86_64-fedora23/bin

Comment 1 Tom Stellard 2017-03-16 21:15:31 UTC
clang defaults to using the libomp runtime which is not currently packaged with fedora.  You can use the libgomp runtime instead, but you need to manually specify the include path, because clang does not auto-detect the headers installed with libgomp (The include path on your system might look slightly different)

For example:

./bin/clang -fopenmp=libgomp -I /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/ omp_hello.c

Comment 2 Satish Balay 2017-03-22 14:25:59 UTC
Sure there are workarounds. This is an RFE for enabling clang native support for OpenMP

If you want to rephrase it as "RFE for packaging llvm libomp" - thats fine

Comment 3 Ron Lovell 2017-08-20 23:35:24 UTC
On my Rawhide system, I can link a Clang-compiled executable to libgomp using the workaround given above, but it runs single-threaded, even if I call omp_set_num_threads() explicitly. Packaging LLVM OpenMP for Fedora would be a help to us math & science types.  BTW, building the LLVM 4.0.1 OpenMP library from source works fine under Rawhide. It's quite stand-alone, not requiring an LLVM build.

Comment 4 Tom Stellard 2018-01-18 16:14:13 UTC
libomp package is now in Rawhide and Fedora 27.

Comment 5 Ron Lovell 2018-01-20 17:06:47 UTC
libomp and libomp-devel 5.0.1 are working fine with Clang 5.0.1 on my Rawhide system. Good work, guys.


Note You need to log in before you can comment on or make changes to this bug.