Offload to GPU fails due to undefined references

Hello,

I'm trying to compile an HPC application (LULESH) with offloading to a
CUDA GPU.
This is the application:

I compiled it with success with GCC and XLC.
I can compile and run codes that offload to the GPU with clang for
simple applications.

So, going into the details of the issue.

I try to compile with the following line:
mpic++ -v -o lulesh2.0 lulesh.cc lulesh-comm.cc lulesh-viz.cc
lulesh-util.cc lulesh-init.cc -O0 -fopenmp=libomp
-fopenmp-targets=nvptx64-nvidia-cuda -DUSE_MPI=1 -lstdc++

When compiling with clang I get the following error:
"clang-7: error: nvlink command failed with exit code 255 (use -v to see
invocation)
make: *** [lulesh2.0] Error 255"

This error is caused because 'nvlink' gets several Undefined references
to different functions (GCC and XLC don't encounter this problem)

The output generated when compiling with clang (due to its size, only the relevant text is attached, let me know if you need the full output)

clang information (with MPI wrapper):
$ mpic++ -v
Version 6
clang version 7.0.0 (tags/RELEASE_700/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/user/pkg/clang/7.0.0/bin
Found candidate GCC installation:
/apps/GCC/7.3.0-offload/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0
Selected GCC installation:
/apps/GCC/7.3.0-offload/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-9.2, version 9.2

Also, using openmpi 3.0.0

Hopefully somebody has an idea on what's going on here.
If you need any more information to find the issue, let me know.

Thank you,
-Cristobal

http://bsc.es/disclaimer

clang.output (46.9 KB)