Closed
Description
Bug Description
At some point after v1.2.0 the TensorRT\core\runtime\TRTEngine.h
file was added and it brought the #include <experimental/filesystem>
with it. I had some issues trying to build due to this. A #define
is needed to build, the path
cannot implicitly be converted to a std::string
, an extra #include
is needed to use std::stringbuilder
and there is no stdc++fs
to link against.
Environment
- Torch-TensorRT Version: master f43be5b
- PyTorch Version: libtorch 1.13.1+cu117
- CPU Architecture: amd64
- OS: Windows 11
- Python version: Python 3.10.9
- CUDA version: 11.8
- cmake version: cmake version 3.21.21080301-MSVC_2
- cl version: Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30706 for x64
- MSVC toolchain version: 14.30.30705
Rough fix
The below changes were needed to get a compile. They probably would break the build on other systems - so maybe need to be based on some platform detection.
Additional CMAKE flag
{
"name": "CMAKE_CXX_FLAGS",
"value": "-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING",
"type": "STRING"
}
Code changes
diff --git a/core/runtime/CMakeLists.txt b/core/runtime/CMakeLists.txt
index d21c661a..b3632e8f 100644
--- a/core/runtime/CMakeLists.txt
+++ b/core/runtime/CMakeLists.txt
@@ -33,7 +33,6 @@ target_link_libraries(${lib_name}
TensorRT::nvinfer
torch
core_util
- stdc++fs
)
# Install
diff --git a/core/runtime/TRTEngine.h b/core/runtime/TRTEngine.h
index 5615a824..1a2df1f2 100644
--- a/core/runtime/TRTEngine.h
+++ b/core/runtime/TRTEngine.h
@@ -25,7 +25,7 @@ struct TRTEngine : torch::CustomClassHolder {
std::string name;
RTDevice device_info;
- std::string profile_path_prefix = std::experimental::filesystem::temp_directory_path();
+ std::string profile_path_prefix = std::experimental::filesystem::temp_directory_path().string();
std::unordered_map<uint64_t, uint64_t> in_binding_map = {}; // TRT IDX -> PYT IDX
std::unordered_map<uint64_t, uint64_t> out_binding_map = {}; // TRT IDX -> PYT IDX
diff --git a/core/runtime/TRTEngineProfiler.cpp b/core/runtime/TRTEngineProfiler.cpp
index a1159516..7857a467 100644
--- a/core/runtime/TRTEngineProfiler.cpp
+++ b/core/runtime/TRTEngineProfiler.cpp
@@ -1,5 +1,6 @@
#include <algorithm>
#include <fstream>
+#include <sstream>
#include <iomanip>
#include "core/runtime/TRTEngineProfiler.h"