[Openmp-dev] Using OpenMP target offloading in llvm-8.0.0

Doerfert, Johannes via Openmp-dev openmp-dev at lists.llvm.org
Wed Nov 13 17:23:08 PST 2019


This looks like a bug in 8.0 that is fixed in trunk.
You have a `target teams distribute`, right?

Can you put an empty target region before that and see if it helps.

Cheers,
  Johannes

P.S.
 This is the right place to ask these questions

________________________________________
From: Openmp-dev <openmp-dev-bounces at lists.llvm.org> on behalf of Stephane Genaud via Openmp-dev <openmp-dev at lists.llvm.org>
Sent: Wednesday, November 13, 2019 08:30
To: openmp-dev at lists.llvm.org
Subject: [Openmp-dev] Using OpenMP target offloading in llvm-8.0.0




Hello,

i came across this message on the list and found no better place to ask for help on a similar problem.
I am just experimenting offloading to x86_64 code from a x86_64 host system (ubuntu 18.04).
I have the packages:
- libomp-8-dev , containing among others :
   /usr/lib/llvm-8/lib/libomptarget.so
   /usr/lib/llvm-8/lib/libgomp.so
   /usr/lib/llvm-8/lib/libiomp5.so
   /usr/lib/llvm-8/lib/libomp.so
- clang-8

I compiled the same offload.c program as the one given in the referenced mail.

My first try was :
$ clang-8 -g -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu offload.c

which did produce a binary a.out,  but this one fails with the cryptic error message:
$ export LD_LIBRARY_PATH=/usr/lib/llvm-8/lib/
$ ./a.out
Libomptarget fatal error 1: default offloading policy must switched to mandatory or disabled

Second try, after reading some of the hints was
$ clang-8 -g -I//usr/lib/llvm-8/include/ -L/usr/lib/llvm-8/lib -Xopenmp-target -march=x86-64 -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu offload.c

which resulted in the same error.
By the way, i have no clue why -Xopenmp-target -march=x86-64 would be required, which quite seem redundant with -fopenmp_targets.

I went to see the source code at
https://github.com/llvm-mirror/openmp/blob/master/libomptarget/src/interface.cpp  line:56
but still can’t figure out what makes libomptarget unhappy.
In case this is related to ‘device’, i tested omp_get_default_device() which returns 1.

Any help would be appreciated.
Thanks.


> Hi,

> When trying to use openmp target offloading with llvm I get the following error
> *$ cat offload.cpp*
> > #include <omp.h>
> > int main() {
> > #pragma omp target teams distribute parallel for
> > for(int i=0; i<100; i++);
> > return 0;
> > }
> > *$ clang++ -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
> > --cuda-path=$CUDA_TOOLKIT_ROOT_DIR offload.cpp -o offload*
> > *$ ./offload*
> > Libomptarget fatal error 1: default offloading policy must switched to
> > mandatory or disabled
> > *$*
> I have llvm-8.0.0 installed in my system at LLVM_PATH. I downloaded openmp-8.0.0 source from the llvm download page. To build openmp I used the following command: $ mkdir build && cd build > $ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$LLVM_PATH
> > -DCMAKE_C_COMPILER=$LLVM_PATH/bin/clang -DCMAKE_CXX_COMPILER= $LLVM_PATH/bin/clang++
> > -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=35,60,70 ..
> > $ make && make install
> > $
> OpenMP got built without giving any error. But when trying to use target offloading with OpenMP I get the above mentioned fatal error. I tried this on 3 different machines, with same result. -- Thank You. Regards, Alok
_______________________________________________
Openmp-dev mailing list
Openmp-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list