2

I have been trying to use gcc (trunk version) offloading but so far I am failing to do so. I compiled gcc following the instructions for OpenACC offloading with nvidia from this site: https://gcc.gnu.org/wiki/Offloading I also compiled the host compiler following the instructions of the same website. However, I get an error when I try to compile anything with OpenACC enabled. To make sure I am using the right compiler I cd into the directory of the host compiler and I run this: ./g++ main.cpp -fopenacc -foffload=nvptx-none But I get this error:

lto-wrapper: fatal error: problem with building target image for nvptx-none

compilation terminated.
/mnt/home/george/usr/local/gcc-7/bin/../lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Running ./g++ -v gives me the following:

Using built-in specs.
COLLECT_GCC=../g++
COLLECT_LTO_WRAPPER=/mnt/home/george/usr/local/gcc-7/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=x86_64-intelmicemul-linux-gnu:nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7-20161211/configure --prefix=/home/george/usr/local/gcc-7 --disable-multilib --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --enable-offload-targets=x86_64-intelmicemul-linux-gnu=/home/george/usr/local/gcc-7-mic,nvptx-none=/home/george/usr/local/nvptx-tools/nvptx-none --with-cuda-driver=/usr/local/cuda-7.5
Thread model: posix
gcc version 7.0.0 20161211 (experimental) (GCC)`

I would really appreciate If someone could point me to the right direction on what exactly is causing this error.

PS: I have also compiled gcc for Intel mic offloading but I don't care about this for now.

EDIT 1:

When I compile the host compiler, where is the --enable-offload-targets=nvptx-none=XXX should point to? The compiled nvptx or the accel compiler? Also, the nvptx-tools directory includes a bin directory and a nvptx-none\bin directory. Currently I point it to the latter.

AstrOne
  • 3,569
  • 7
  • 32
  • 54
  • It seems like nvptx linker failed. What about `-foffload=nvptx-none="-Wl,-verbose -Wl,-debug"` ? – Ilya Verbin Dec 16 '16 at 19:18
  • @IlyaVerbin Thanks for the reply my friend. Unfortunately the suggested command gives me the exact same error. I am going to edit my question now with some more info just in case it helps. – AstrOne Dec 17 '16 at 06:51
  • I am guessing something went wrong with the build process. Maybe you can try using the scripts at https://github.com/olcf/OLCFHack15/tree/master/GCC5OffloadTest. I could use the script for building gcc 6.2 with openacc support. Of course you'll have to do some changes to account for the path changes. – Vikram Dec 22 '16 at 10:17
  • I have attempted the same nvptx-offloading but with slightly newer GCC 7.1.0 and everything works great on my Fedora 26 box. Have you tried the same process with GCC 7.1.0? Also, can you give me the output of 'ls -l /home/george/usr/local/nvptx-tools/nvptx-none' as it might be enlightening. – Joshua T Sep 19 '17 at 10:28
  • 1
    I finally made it. I guess simply because the gcc7 with offloading support is now part of the Debian testing repository. So, I just typed sudo apt-get install gcc-7-offload-nvptx and everything worked like a charm :) Of course the performance of my OpenACC code is REALLY bad when compared to the PGI compiler. But at least it works! – AstrOne Sep 19 '17 at 12:45
  • How did you get this working for OpenMP? – Z boson Mar 02 '18 at 12:55

0 Answers0