onnxruntime: [Build] Error building with tensorrt on Linux
Describe the issue
When trying to build onnxruntime with -use_tensorrt I get basically the error that cmake --build can’t find any of the files that should have been created by the cmake configuration run.
Unfortunately build.py does not provide a way to see the output of cmake if there is no error return. Equally unfortunately cmake does not seem to return an error code even though it erred out and didn’t return any files.
I hacked build.py to unconditionally print stdout and stderr from the cmake subprocess and got this error message:
NVCC_ERROR = NVCC_OUT = No such file or directory CMake Error at /usr/local/share/cmake-3.27/Modules/CMakeDetermineCUDACompiler.cmake:603 (message): Failed to detect a default CUDA architecture. Compiler output: Call Stack (most recent call first): CMakeLists.txt:674 (enable_language)
There was also earlier in stderr a complaint about CMP0104 being “OLD”:
CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy): The OLD behavior for policy CMP0104 will be removed from a future version of CMake.
This seems to be related to not setting up any default CUDA architecture.
I don’t know if it is normal that building tensorrt requires this.
My initial thought was that building tensorrt without also building cuda was not supported, as there seemed to be some code that sets the variable CMAKE_CUDA_ARCHITECTURES mentioned in https://cmake.org/cmake/help/latest/policy/CMP0104.html
This didn’t help at all.
Now I’m totally at a loss.
Urgency
Medium urgency. There is still time before our deadline, we just want to be able to build onnxruntime on all paltforms with the best providers for each graphics board make. We don’t know what make our customers have so we need to have an omnipotent onnxruntime library which does not seem to exist as precompiled binaries.
Target platform
Linux 64 bit, ubuntu 20.04 using NVIDIA docker image
Build script
build.py --build_dir /src/onnxruntime/build/Linux --config Release --parallel 4 --build_shared_lib --build_dir build_gpu/Linux --skip_tests --use_tensorrt --cuda_version=11.8 --cuda_home /usr/local/cuda --cudnn_home /usr/local/cuda --tensorrt_home /usr/include/x86_64-linux-gnu
Note that the --tensorrt_home directory is what I could guess after installing apt install tensorrt-dev. This is not documented and the frustrated questions found on the web have not been answered. It would be appreciated if the installation instructions were a bit more elabroate than “install tenstorrt”. Took me days to figure out that what you mean was tensorrt-dev and then to find the directory of the header files.
I don’t think that this directory selection is the root cause in this case though.
Error / output
NVCC_ERROR = NVCC_OUT = No such file or directory CMake Error at /usr/local/share/cmake-3.27/Modules/CMakeDetermineCUDACompiler.cmake:603 (message): Failed to detect a default CUDA architecture. Compiler output: Call Stack (most recent call first): CMakeLists.txt:674 (enable_language)
printed to stderr by the cmake configure step but this does not stop build.py from trying to do cmake --build which of course fails as there are no files for it to act on.
I also print all thearguments you send to cmake, but I have no idee what to look for so here you go:
Namespace(acl_home=None, acl_libs=None, allow_running_as_root=False, android=False, android_abi=‘arm64-v8a’, android_api=27, android_cpp_shared=False, android_ndk_path=‘’, android_run_emulator=False, android_sdk_path=‘’, apple_deploy_target=None, arm=False, arm64=False, arm64ec=False, armnn_bn=False, armnn_home=None, armnn_libs=None, armnn_relu=False, build=False, build_apple_framework=False, build_csharp=False, build_dir=‘build_gpu/Linux’, build_java=False, build_micro_benchmarks=False, build_nodejs=False, build_nuget=False, build_objc=False, build_shared_lib=True, build_wasm=False, build_wasm_static_lib=False, build_wheel=False, cann_home=None, clean=False, cmake_extra_defines=None, cmake_generator=None, cmake_path=‘cmake’, code_coverage=False, compile_no_warning_as_error=False, config=[‘Release’], ctest_path=‘ctest’, cuda_home=‘/usr/local/cuda’, cuda_version=‘11.8’, cudnn_home=‘/usr/local/cuda’, disable_contrib_ops=False, disable_exceptions=False, disable_memleak_checker=False, disable_ml_ops=False, disable_rtti=False, disable_types=[], disable_wasm_exception_catching=False, dml_external_project=False, dml_path=‘’, dnnl_gpu_runtime=‘’, dnnl_opencl_root=‘’, eigen_path=None, emscripten_settings=None, emsdk_version=‘3.1.44’, enable_cuda_line_info=False, enable_cuda_profiling=False, enable_external_custom_op_schemas=False, enable_language_interop_ops=False, enable_lazy_tensor=False, enable_lto=False, enable_memory_profile=False, enable_msinternal=False, enable_msvc_static_runtime=False, enable_nccl=False, enable_nvtx_profile=False, enable_onnx_tests=False, enable_pybind=False, enable_reduced_operator_type_support=False, enable_rocm_profiling=False, enable_symbolic_shape_infer_tests=False, enable_training=False, enable_training_apis=False, enable_training_ops=False, enable_transformers_tool_test=False, enable_wasm_api_exception_catching=False, enable_wasm_debug_info=False, enable_wasm_exception_throwing_override=True, enable_wasm_profiling=False, enable_wasm_simd=False, enable_wasm_threads=False, enable_wcos=False, extensions_overridden_path=None, external_graph_transformer_path=None, fuzz_testing=False, gdk_edition=‘.’, gdk_platform=‘Scarlett’, gen_api_doc=False, gen_doc=None, include_ops_by_config=None, ios=False, ios_sysroot=‘’, ios_toolchain_file=‘’, llvm_config=‘’, llvm_path=None, migraphx_home=None, minimal_build=None, mpi_home=None, ms_experimental=False, msbuild_extra_options=None, msvc_toolset=None, nccl_home=None, nnapi_min_api=None, numpy_version=None, nvcc_threads=-1, osx_arch=‘x86_64’, parallel=4, path_to_protoc_exe=None, qnn_home=None, rocm_home=None, rocm_version=None, skip_keras_test=False, skip_nodejs_tests=False, skip_onnx_tests=False, skip_submodule_sync=False, skip_tests=True, skip_winml_tests=False, snpe_root=None, target=None, tensorrt_home=‘/usr/include/x86_64-linux-gnu’, test=False, test_all_timeout=‘10800’, tvm_cuda_runtime=False, update=False, use_acl=None, use_armnn=False, use_azure=False, use_cache=False, use_cann=False, use_coreml=False, use_cuda=False, use_dml=False, use_dnnl=False, use_extensions=False, use_full_protobuf=False, use_gdk=False, use_jsep=False, use_lock_free_queue=False, use_migraphx=False, use_mimalloc=False, use_mpi=False, use_nnapi=False, use_openvino=None, use_preinstalled_eigen=False, use_qnn=False, use_rknpu=False, use_rocm=False, use_snpe=False, use_telemetry=False, use_tensorrt=True, use_tensorrt_builtin_parser=True, use_tensorrt_oss_parser=False, use_triton_kernel=False, use_tvm=False, use_tvm_hash=False, use_vitisai=False, use_webnn=False, use_winml=False, use_xnnpack=False, wasm_malloc=None, wasm_run_tests_in_browser=False, wheel_name_suffix=None, windows_sdk_version=None, winml_root_namespace_override=None, x86=False, xcode_code_signing_identity=‘’, xcode_code_signing_team_id=‘’)
Failed to import psutil. Please pip install psutil for better estimation of nvcc threads. Use nvcc_threads=1
Making dir: build_gpu/Linux/Release
Calling cmake with 91 arguments.
Visual Studio Version
No response
GCC / Compiler Version
gcc 10.4, cmake 3.27, pthon 3.10 running in docker image FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Disable parallel builds due to psutil issue ( #17991) — committed to Preference-Kim/onnxruntime by Preference-Kim 2 years ago
mobile was wrongly guessed by bot. This is on Linux/desktop.