Skip to content

Compilation Error When Including `unsupported/Eigen/CXX11/Tensor`

Source: test.cu

Command: /usr/local/cuda/bin/nvcc -v -I/home/lambdaknight/repro/_deps/eigen3-src --expt-relaxed-constexpr -c test.cu -o test.cu.o where _/home/lambdaknight/repro/deps/eigen3-src is a clean checkout of libeigen at commit 70fbcf82

Output:

#$ _NVVM_BRANCH_=nvvm
#$ _SPACE_= 
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda/bin
#$ _THERE_=/usr/local/cuda/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/usr/local/cuda/bin/..
#$ NVVMIR_LIBRARY_DIR=/usr/local/cuda/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/usr/local/cuda/bin/../lib:
#$ PATH=/usr/local/cuda/bin/../nvvm/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/home/lambdaknight/.cargo/bin:/home/lambdaknight/bin:/usr/bin:/bin:/usr/local/bin:/home/lambdaknight/.fzf/bin
#$ INCLUDES="-I/usr/local/cuda/bin/../targets/x86_64-linux/include"  
#$ LIBRARIES=  "-L/usr/local/cuda/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ gcc -D__CUDA_ARCH__=520 -E -x c++  -DCUDA_DOUBLE_MATH_FUNCTIONS -D__CUDACC__ -D__NVCC__ -D__CUDACC_RELAXED_CONSTEXPR__  -I"/home/lamdbaknight/repro/_deps/eigen3-src" "-I/usr/local/cuda/bin/../targets/x86_64-linux/include"    -D__CUDACC_VER_MAJOR__=11 -D__CUDACC_VER_MINOR__=0 -D__CUDACC_VER_BUILD__=221 -include "cuda_runtime.h" -m64 "test.cu" -o "/tmp/tmpxft_002ab0f5_00000000-7_test.cpp1.ii" 
#$ cicc --c++14 --gnu_version=80301 --orig_src_file_name "test.cu" --allow_managed --relaxed_constexpr   -arch compute_52 -m64 -ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 --include_file_name "tmpxft_002ab0f5_00000000-3_test.fatbin.c" -tused -nvvmir-library "/usr/local/cuda/bin/../nvvm/libdevice/libdevice.10.bc" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_002ab0f5_00000000-4_test.module_id" --gen_c_file_name "/tmp/tmpxft_002ab0f5_00000000-6_test.cudafe1.c" --stub_file_name "/tmp/tmpxft_002ab0f5_00000000-6_test.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_002ab0f5_00000000-6_test.cudafe1.gpu"  "/tmp/tmpxft_002ab0f5_00000000-7_test.cpp1.ii" -o "/tmp/tmpxft_002ab0f5_00000000-6_test.ptx"
/home/lamdbaknight/repro/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/Default/BFloat16.h(661): warning: calling a __host__ function from a __host__ __device__ function is not allowed

#$ ptxas -arch=sm_52 -m64  "/tmp/tmpxft_002ab0f5_00000000-6_test.ptx"  -o "/tmp/tmpxft_002ab0f5_00000000-8_test.sm_52.cubin" 
#$ fatbinary -64 --cicc-cmdline="-ftz=0 -prec_div=1 -prec_sqrt=1 -fmad=1 " "--image3=kind=elf,sm=52,file=/tmp/tmpxft_002ab0f5_00000000-8_test.sm_52.cubin" "--image3=kind=ptx,sm=52,file=/tmp/tmpxft_002ab0f5_00000000-6_test.ptx" --embedded-fatbin="/tmp/tmpxft_002ab0f5_00000000-3_test.fatbin.c" 
#$ rm /tmp/tmpxft_002ab0f5_00000000-3_test.fatbin
#$ gcc -E -x c++ -D__CUDACC__ -D__NVCC__ -D__CUDACC_RELAXED_CONSTEXPR__  -I"/home/lamdbaknight/repro/_deps/eigen3-src" "-I/usr/local/cuda/bin/../targets/x86_64-linux/include"    -D__CUDACC_VER_MAJOR__=11 -D__CUDACC_VER_MINOR__=0 -D__CUDACC_VER_BUILD__=221 -include "cuda_runtime.h" -m64 "test.cu" -o "/tmp/tmpxft_002ab0f5_00000000-5_test.cpp4.ii" 
#$ cudafe++ --c++14 --gnu_version=80301 --orig_src_file_name "test.cu" --allow_managed --relaxed_constexpr  --m64 --parse_templates --gen_c_file_name "/tmp/tmpxft_002ab0f5_00000000-6_test.cudafe1.cpp" --stub_file_name "tmpxft_002ab0f5_00000000-6_test.cudafe1.stub.c" --module_id_file_name "/tmp/tmpxft_002ab0f5_00000000-4_test.module_id" "/tmp/tmpxft_002ab0f5_00000000-5_test.cpp4.ii" 
/home/lamdbaknight/repro/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/Default/Half.h(803): error: calling a __device__ function("__shfl_sync") from a __host__ __device__ function("__shfl_sync") is not allowed

/home/lamdbaknight/repro/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/Default/Half.h(807): error: calling a __device__ function("__shfl_up_sync") from a __host__ __device__ function("__shfl_up_sync") is not allowed

/home/lamdbaknight/repro/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/Default/Half.h(811): error: calling a __device__ function("__shfl_down_sync") from a __host__ __device__ function("__shfl_down_sync") is not allowed

/home/lamdbaknight/repro/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/Default/Half.h(815): error: calling a __device__ function("__shfl_xor_sync") from a __host__ __device__ function("__shfl_xor_sync") is not allowed

4 errors detected in the compilation of "test.cu".
# --error 0x2 --

uname -srvpio:

Linux 4.18.0-193.14.2.el8_2.x86_64 #1 SMP Sun Jul 26 03:54:29 UTC 2020 x86_64 x86_64 GNU/Linux

/usr/local/cuda/bin/nvcc --version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0

gcc --version:

gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Edited by Turing Eret