LLNL / RAJA

RAJA Performance Portability Layer (C++)
BSD 3-Clause "New" or "Revised" License
484 stars 102 forks source link

IBM XLC PTX code generation FAILED Global Value `__pthread_key_create': extern_weak linkage is not supported. #681

Closed jeffhammond closed 3 years ago

jeffhammond commented 5 years ago

I don't think this is a bug in RAJA but presumably you all know how to compile with XLC OpenMP target support.

cmake  ..  -DCMAKE_BUILD_TYPE=Release   -DCMAKE_CXX_COMPILER=xlc++_r   -DENABLE_OPENMP=On   -DENABLE_TARGET_OPENMP=On   -DOpenMP_CXX_FLAGS="-qoffload;-qsmp=omp;-qnoeh;-qalias=noansi"   -DCMAKE_INSTALL_PREFIX=$HOME/RAJA/install-xl-openmp-target -C ../host-configs/lc-builds/blueos/xl_2019_X.cmake

The last argument doesn't make a difference.

[ 43%] Building CXX object test/unit/omp-target/CMakeFiles/test-omp-target-nested-reduce.exe.dir/test-nested-reduce.cpp.o
cd /home/jrhammon/RAJA/git/build/test/unit/omp-target && /usr/bin/xlc++_r -+ -DGTEST_HAS_DEATH_TEST=1 -I/home/jrhammon/RAJA/git/test/include -I/home/jrhammon/RAJA/git/include -I/home/jrhammon/RAJA/git/build/include -I/home/jrhammon/RAJA/git/tpl/cub -I/home/jrhammon/RAJA/git/tpl/camp/include -I/home/jrhammon/RAJA/git/blt/thirdparty_builtin/googletest-master-2018-02-01/googletest/include  -std=c++14 -O3 -DNDEBUG -qpic   -qoffload -qsmp=omp -qnoeh -qalias=noansi -std=c++11 -o CMakeFiles/test-omp-target-nested-reduce.exe.dir/test-nested-reduce.cpp.o -c /home/jrhammon/RAJA/git/test/unit/omp-target/test-nested-reduce.cpp
PTX code generation FAILED with reason: NVVM_ERROR_INVALID_IR
Compiler log:
Error: : Global Value `__pthread_key_create': extern_weak linkage is not supported.
1586-346 (U) An error occurred during code generation.  The code generation return code was 255.
make[2]: *** [test/unit/omp-target/CMakeFiles/test-omp-target-nested-reduce.exe.dir/test-nested-reduce.cpp.o] Error 1
make[2]: Leaving directory `/admin/home/jrhammon/RAJA/git/build'
make[1]: *** [test/unit/omp-target/CMakeFiles/test-omp-target-nested-reduce.exe.dir/all] Error 2
make[1]: Leaving directory `/admin/home/jrhammon/RAJA/git/build'
make: *** [all] Error 2

All the binaries fail like this.

[jrhammon@ehal01 build]$ /usr/bin/xlc++_r -qversion=verbose
IBM XL C/C++ for Linux, V16.1.1 (Community Edition)
Version: 16.01.0001.0003
Driver Version: 16.1.1(C/C++) Level: 190404 ID: _RXbulUR3EemRhIlXaqgrRQ
C/C++ Front End Version: 16.1.1(C/C++) Level: 190404 ID: _5zS_JFEJEemRhYlXaqgrRQ
High-Level Optimizer Version: 16.1.1(C/C++) and 16.1.1(Fortran) Level: 190404 ID: _8qy2aFcMEemRholXaqgrRQ
Low-Level Optimizer Version: 16.1.1(C/C++) and 16.1.1(Fortran) Level: 190404 ID: _AO0twiBaEemAt6l22ZCkwQ
Intermediate Language Splitter Version: 16.1.1(C/C++) and 16.1.1(Fortran) Level 190404 ID: _YjjuMKTuEeitLMuu6VxByg
W-Code to LLVM-IR Translator: 16.1.1(C/C++) and 16.1.1(Fortran) Level 190404 ID: _k40U8k93EemRhYlXaqgrRQ
NVVM-IR to PTX Translator: 16.1.1(C/C++) and 16.1.1(Fortran) Level 190404 ID: _aZtcAtk6EeiLR71RxbOxBQ
/opt/ibm/xlC/16.1.1/bin/.orig/xlc++_r: note: XL C/C++ Community Edition is a no-charge product and does not include official IBM support. You can provide feedback at the XL on POWER C/C++ Community Edition forum (http://ibm.biz/xlcpp-linux-ce). For information about a fully supported XL C/C++ compiler, visit XL C/C++ for Linux (http://ibm.biz/xlcpp-linux).
jeffhammond commented 5 years ago

I guess this is a documented non-feature of NVCC: https://docs.nvidia.com/cuda/nvvm-ir-spec/index.html#linkage-types. Not sure why nobody else sees it.