NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.57k stars 2.1k forks source link

error: #include nested too deeply #602

Closed Beam-wi closed 3 years ago

Beam-wi commented 4 years ago

Description

I encounter a error of `/usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:61:30: error: #include nested too deeply

include "crt/host_defines.h"when i cmake with.. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=/home/train-server/APP/TensorRT/out`.

I inspect the crt/host_defines.h which in cuda, it shows me #include crt/host_defines.h. It means call-back himself? I suspect the header file of crt/host_defines.h belong to complier g++ rather than cuda. But I cannot find it in complier g++. My gcc version is 7.5.0. So is it useful? Could you give me some advices please? Would Be Greatly Appreciated.

Environment

TensorRT Version: 7.0 GPU Type: RTX 2080Ti Nvidia Driver Version: 440.82 CUDA Version: 10.2 CUDNN Version: 7.6.5 Operating System + Version: Ubuntu-18.04.4 Python Version (if applicable): 3.7.7 TensorFlow Version (if applicable): PyTorch Version (if applicable): Baremetal or Container (if container which image + tag): GCC Version:7.5.0 G++ Version:7.5.0 Cmake Version:3.17.3 GNU Make Version:4.1

Relevant Files

The host_defines.h is like the below which in the cuda crt.

#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ #if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__) #if defined(_MSC_VER) #pragma message("host_defines.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.") #else #warning "host_defines.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead." #endif #define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ #define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER__ #endif

#include "crt/host_defines.h"

#if defined(UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER) #undef CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS #undef UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H_WRAPPER #endif `

The CMakeError.log is: ` Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed. Compiler: /usr/local/cuda-10.2/bin/nvcc Build flags: Id flags: -v;--keep;--keep-dir;tmp

The output was: 1

$ _NVVMBRANCH=nvvm

$ SPACE=

$ CUDART=cudart

$ HERE=/usr/local/cuda-10.2/bin

$ THERE=/usr/local/cuda-10.2/bin

$ _TARGETSIZE=

$ _TARGETDIR=

$ _TARGETDIR=targets/x86_64-linux

$ TOP=/usr/local/cuda-10.2/bin/..

$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-10.2/bin/../nvvm/libdevice

$ LD_LIBRARY_PATH=/usr/local/cuda-10.2/bin/../lib:/usr/local/cuda/lib64:/home/train-server/App/TensorRT-7.0.0.11/lib

$ PATH=/usr/local/cuda-10.2/bin/../nvvm/bin:/usr/local/cuda-10.2/bin:/opt/anaconda3/condabin:/usr/local/cuda-10.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/train-server/bin:/usr/local/python3.7/bin

$ INCLUDES="-I/usr/local/cuda-10.2/bin/../targets/x86_64-linux/include"

$ LIBRARIES= "-L/usr/local/cuda-10.2/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda-10.2/bin/../targets/x86_64-linux/lib"

$ CUDAFE_FLAGS=

$ PTXAS_FLAGS=

$ rm tmp/a_dlink.reg.c

$ gcc -DCUDA_ARCH__=300 -E -x c++ -DCUDA_DOUBLE_MATH_FUNCTIONS -DCUDACC -DNVCC__ "-I/usr/local/cuda-10.2/bin/../targets/x86_64-linux/include" -DCUDACC_VER_MAJOR=10 -DCUDACC_VER_MINOR=2 -DCUDACC_VER_BUILD=89 -include "cuda_runtime.h" -m64 "CMakeCUDACompilerId.cu" -o "tmp/CMakeCUDACompilerId.cpp1.ii"

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_config.h:60:0, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_config.h:60, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_config.h:60, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:83, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_config.h:60:29: error: #include nested too deeply

include "crt/host_config.h"

                         ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/device_types.h:58, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/builtin_types.h:56, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:91, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/driver_types.h:58, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/builtin_types.h:59, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:91, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/vector_types.h:64, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/driver_types.h:59, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/builtin_types.h:59, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:91, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime_api.h:138, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/channel_descriptor.h:61, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:95, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/driver_functions.h:54, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:97, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

In file included from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:0, ... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:100, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:60:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

... ... from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/device_double_functions.hpp:85, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/device_double_functions.h:1178, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/device_functions.h:3279, from /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/cuda_runtime.h:118, from :0: /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_defines.h:61:30: error: #include nested too deeply

include "crt/host_defines.h"

                          ^

CMakeFiles/cmTC_aefb7.dir/build.make:85: recipe for target 'CMakeFiles/cmTC_aefb7.dir/main.cu.o' failed make[1]: [CMakeFiles/cmTC_aefb7.dir/main.cu.o] Error 1 make[1]: Leaving directory '/home/train-server/App/TensorRT/build/CMakeFiles/CMakeTmp' Makefile:141: recipe for target 'cmTC_aefb7/fast' failed make: [cmTC_aefb7/fast] Error 2

`

Steps To Reproduce

I make just like the guide

git clone -b master https://github.com/nvidia/TensorRT TensorRT -b release/7.0 cd TensorRT git submodule update --init --recursive export TRT_SOURCE='pwd'

then get the TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz and cd ~/Downloads # Download TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz tar -xvzf TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz export TRT_RELEASE=pwd/TensorRT-7.0.0.11 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TRT_RELEASE/lib

finally cd $TRT_SOURCE mkdir -p build && cd build cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR='pwd'/out

mk-nvidia commented 3 years ago

@Beam-wi Can you please try this with TensorRT-7.1? I tried reproducing the problem with this version but I couldn't.

ttyio commented 3 years ago

I will close since get no response for more than 3 weeks, please reopen if you still have question, thanks!