cyrusbehr / tensorrt-cpp-api

TensorRT C++ API Tutorial
MIT License
577 stars 72 forks source link

Modify the project structure and add cross-platform support. #19

Closed xunzixunzi closed 3 months ago

xunzixunzi commented 11 months ago

Brief explanation:

  1. Modify Util namespace to EngineUtil: Reduce the potential for name duplication.
  2. Move serializeEngineOptions() to EngineUtil namespace
  3. Modify getDeviceNames() to getGpuDeviceNames() and move it to EngineUtil namespace: Users can easily view their GPUs indexes.
  4. Change build() to a static function: Users do not need to create an Engine object in order to build the ONNX file.
  5. Change "m_logger" to static member: To adapt to the 4th point.
  6. Remove m_calibrator and m_engineName: To adpat to the 4th point.
  7. Modify loadNetwork(): Users can switch between different TensorRT engine files at any time.
  8. Modify the constructor: To adapt to the 7th point.
  9. Modify m_engineOptions to non-const: To adapt to the 7th point.
  10. Add the function 'doesDirectoryExist()': Using 'doesFileExist()' to check if a folder exists is not feasible, so I need to modify it to a method that works universally on both Windows and Linux platforms (Linux platform not tested).

Tested only on the Windows platform; I may need your help to test it on Linux.

cyrusbehr commented 11 months ago

Great thank you for putting this together. I will review in the next few days.

willyfh commented 9 months ago

Thank you for these great updates. I think it would have been helpful if you also updated the readme to provide the guide to set up the project in the Windows platform.

thomaskleiven commented 3 months ago

Can we close this PR?

cyrusbehr commented 3 months ago

Can we close this PR?

Yes let's close this for now. I however would like to add Windows support at some point. With this particular PR, I never had a chance to test it on Windows, and I didn't like that many of the CMake dependency paths were hard coded, and the build also failed on Linux b/c the author failed to test on that platform (which is the main platform we support).