[LLVMdev] How to Run OpenMP application Using "lli"

Arnamoy Bhattacharyya arnamoy at ualberta.ca
Sat Jun 16 12:38:07 PDT 2012


Hi;

Both -fplugin-arg-dragonegg-emit-ir and -flto works for creating llvm
bitcode that can be run with lli.  Thanks to Nick for the suggestion.

Now, trying to run an OpenMP hello world program.

llvm-gcc -fopenmp p_hello.c -flto -S -o p_hello.ll
lli p_hello.ll

output: LLVM ERROR: Program used external function 'GOMP_parallel_start'
which could not be resolved!

I am guessing that I have to link libgomp.a somehow but want to know the
correct way to do it.

Other way around using gcc:

llvm-gcc -fopenmp p_hello.c -flto -S -o p_hello.ll
llc p_hello.ll
gcc -fopenmp p_hello.s -o p_hello
./p_hello

output:

Hello World
Hello World
Hello World
Hello World

I guess this is not the (only) way to run OpenMP programs. I can guess that
compiling the libgomp into LLVM IR and then linking it with the hello.ll
will allow me to run it with lli?
Any other suggestion on how to run them?
-- 
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Alberta, Canada, T6G 2E8
587-710-7073
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120616/724ff7f8/attachment.html>


More information about the llvm-dev mailing list