简体   繁体   中英

Binary doesn't work and IR doesn't have any characteristic forking calls

I was trying to run openmp code with clang 10.0.0 using libgomp.

Here is what I did to run the code using libomp (I need to see the LLVM-IR too)

clang -Xclang -cc1 file.c -emit-llvm -S -fopenmp=libomp
clang -fopenmp=libomp file.ll

Here, the binary works as expected (in parallel) and the IR has characteristic @__kmpc_fork_call function.

When I try the same using libgomp

clang -Xclang -cc1 file.c -emit-llvm -S -fopenmp=libgomp
clang -fopenmp=libgomp file.ll

In this case, neither the binary works as expected (only one thread runs) nor does the IR have any characteristic forking calls. Am I doing something wrong here?

AFAIK, this feature is sadly not really supported so far. The last version of Clang (12.0) clearly does not generate GOMP function calls while it does with its own OpenMP runtime.

See this reported bug for more information. Developers say:

I don't think -fopenmp=libgomp is functional at all. [...] -fopenmp=libgomp is just like you compile without -fopenmp . [...] Clang uses only libomp interface and does not rely on libgomp .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM