Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lidar_centerpoint): add build only option for tensorrt engine #2677

Merged
merged 9 commits into from
Mar 14, 2023

Conversation

yukke42
Copy link
Contributor

@yukke42 yukke42 commented Jan 18, 2023

Signed-off-by: yukke42 yusuke.muramatsu@tier4.jp

Description

Add a new feature to build onnx files to tensorrt engine files without inference for CI/CD requirements.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Jan 18, 2023
@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.81 🎉

Comparison is base (8c6797e) 11.93% compared to head (9ad6b01) 12.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2677      +/-   ##
==========================================
+ Coverage   11.93%   12.75%   +0.81%     
==========================================
  Files        1320     1218     -102     
  Lines       91849    85981    -5868     
  Branches    24469    24469              
==========================================
  Hits        10965    10965              
+ Misses      69523    63655    -5868     
  Partials    11361    11361              
Flag Coverage Δ *Carryforward flag
differential 0.00% <ø> (?)
total 12.75% <ø> (+0.81%) ⬆️ Carriedforward from e310f15

*This pull request uses carry forward flags. Click here to find out more.

see 102 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@yukke42 yukke42 marked this pull request as ready for review February 17, 2023 06:39
@yukke42 yukke42 requested review from knzo25 and a team as code owners February 17, 2023 06:39
@yukke42 yukke42 marked this pull request as draft March 2, 2023 08:20
Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
@github-actions github-actions bot added the type:documentation Creating or refining documentation. (auto-assigned) label Mar 6, 2023
@yukke42 yukke42 changed the title feat(lidar_centerpoint): build onnx to tensorrt engine without inference feat(lidar_centerpoint): add build only option for tensorrt engine Mar 6, 2023
@yukke42 yukke42 marked this pull request as ready for review March 6, 2023 09:07
yukke42 and others added 5 commits March 7, 2023 10:31
Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
@yukke42
Copy link
Contributor Author

yukke42 commented Mar 7, 2023

A node cannot be shutdown successfully, I'll investigate this issue.

image

@yukke42 yukke42 marked this pull request as draft March 7, 2023 03:22
@knzo25
Copy link
Contributor

knzo25 commented Mar 10, 2023

@yukke42

I think this has to do with the destructor order due to the data relationship of some elements.

If I add this, the problem goes away:

TensorRTWrapper::~TensorRTWrapper()
{
  context_.reset();
  runtime_.reset();
  plan_.reset();
  engine_.reset();
}

Log:

ros2 launch lidar_centerpoint lidar_centerpoint.launch.xml build_only:=true
[INFO] [launch]: All log files can be found below /home/kenzolobos/.ros/log/2023-03-13-10-55-11-049175-npc2103019-402737
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [lidar_centerpoint_node-1]: process started with pid [402745]
[lidar_centerpoint_node-1] 1678672511.315870 [139] lidar_cent: config: //CycloneDDS/Domain/General: 'NetworkInterfaceAddress': deprecated element (file:///opt/autoware/cyclonedds_config.xml line 5)
[lidar_centerpoint_node-1] 1678672511.315893 [139] lidar_cent: config: //CycloneDDS/Domain/Internal/MinimumSocketReceiveBufferSize: setting moved to //CycloneDDS/Domain/Internal/SocketReceiveBufferSize[@min] (line 8)
[lidar_centerpoint_node-1] [INFO] [1678672511.675429330] [tensorrt_common]: [MemUsageChange] Init CUDA: CPU +303, GPU +0, now: CPU 332, GPU 245 (MiB)
[lidar_centerpoint_node-1] [INFO] [1678672511.705650244] [tensorrt_common]: Loaded engine size: 0 MiB
[lidar_centerpoint_node-1] [INFO] [1678672511.707445022] [tensorrt_common]: [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB)
[lidar_centerpoint_node-1] Loaded engine from /home/kenzolobos/workspace/pilot-auto/install/lidar_centerpoint/share/lidar_centerpoint/data/pts_voxel_encoder_centerpoint_tiny.engine
[lidar_centerpoint_node-1] [INFO] [1678672511.709265274] [tensorrt_common]: [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +157, now: CPU 0, GPU 157 (MiB)
[lidar_centerpoint_node-1] [INFO] [1678672511.718010348] [lidar_centerpoint]: TensorRT engine is built and shutdown node.
[INFO] [lidar_centerpoint_node-1]: process has finished cleanly [pid 402745]

Additionally, there are some unused variables

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
@yukke42
Copy link
Contributor Author

yukke42 commented Mar 13, 2023

@yukke42

I think this has to do with the destructor order due to the data relationship of some elements.

If I add this, the problem goes away:

TensorRTWrapper::~TensorRTWrapper()
{
  context_.reset();
  runtime_.reset();
  plan_.reset();
  engine_.reset();
}

Log:

ros2 launch lidar_centerpoint lidar_centerpoint.launch.xml build_only:=true
[INFO] [launch]: All log files can be found below /home/kenzolobos/.ros/log/2023-03-13-10-55-11-049175-npc2103019-402737
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [lidar_centerpoint_node-1]: process started with pid [402745]
[lidar_centerpoint_node-1] 1678672511.315870 [139] lidar_cent: config: //CycloneDDS/Domain/General: 'NetworkInterfaceAddress': deprecated element (file:///opt/autoware/cyclonedds_config.xml line 5)
[lidar_centerpoint_node-1] 1678672511.315893 [139] lidar_cent: config: //CycloneDDS/Domain/Internal/MinimumSocketReceiveBufferSize: setting moved to //CycloneDDS/Domain/Internal/SocketReceiveBufferSize[@min] (line 8)
[lidar_centerpoint_node-1] [INFO] [1678672511.675429330] [tensorrt_common]: [MemUsageChange] Init CUDA: CPU +303, GPU +0, now: CPU 332, GPU 245 (MiB)
[lidar_centerpoint_node-1] [INFO] [1678672511.705650244] [tensorrt_common]: Loaded engine size: 0 MiB
[lidar_centerpoint_node-1] [INFO] [1678672511.707445022] [tensorrt_common]: [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB)
[lidar_centerpoint_node-1] Loaded engine from /home/kenzolobos/workspace/pilot-auto/install/lidar_centerpoint/share/lidar_centerpoint/data/pts_voxel_encoder_centerpoint_tiny.engine
[lidar_centerpoint_node-1] [INFO] [1678672511.709265274] [tensorrt_common]: [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +157, now: CPU 0, GPU 157 (MiB)
[lidar_centerpoint_node-1] [INFO] [1678672511.718010348] [lidar_centerpoint]: TensorRT engine is built and shutdown node.
[INFO] [lidar_centerpoint_node-1]: process has finished cleanly [pid 402745]

Additionally, there are some unused variables

@knzo25 Thank you for your advise! I have fixed the error.

@yukke42 yukke42 marked this pull request as ready for review March 13, 2023 07:45
Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than a typo, LGTM !
Checked the runtime of the engine generation and posterior loading

Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yukke42 yukke42 enabled auto-merge (squash) March 14, 2023 02:55
@yukke42 yukke42 disabled auto-merge March 14, 2023 02:56
@yukke42
Copy link
Contributor Author

yukke42 commented Mar 14, 2023

@wep21 Cloud you check the updates? 🙇

@wep21 wep21 self-requested a review March 14, 2023 06:25
Copy link
Contributor

@wep21 wep21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yukke42 yukke42 enabled auto-merge (squash) March 14, 2023 06:29
@yukke42 yukke42 merged commit c1d28c9 into autowarefoundation:main Mar 14, 2023
@yukke42 yukke42 deleted the build-onnx branch March 14, 2023 07:20
taikitanaka3 pushed a commit to taikitanaka3/autoware.universe that referenced this pull request Aug 22, 2023
…utowarefoundation#2677)

* feat(lidar_centerpoint): add build only option for tensorrt engine

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* fix typo

Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>

* style(pre-commit): autofix

* chore: add description

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* chore: shutdown node

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* feat: use tensorrt_commom

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* fix: resolve the crash when shutting down the node

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>

* chore: fix typo

Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>

* style(pre-commit): autofix

---------

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
taikitanaka3 added a commit that referenced this pull request Aug 23, 2023
* feat(lidar_centerpoint): add build only option for tensorrt engine (#2677)

* feat(lidar_centerpoint): add build only option for tensorrt engine

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* fix typo

Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>

* style(pre-commit): autofix

* chore: add description

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* chore: shutdown node

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* feat: use tensorrt_commom

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>

* fix: resolve the crash when shutting down the node

Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>

* chore: fix typo

Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>

* style(pre-commit): autofix

---------

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>

* fix(lidar_centerpoint): fix class (#3934)

* fix(lidar_centerpoint): fix class

Signed-off-by: Shin-kyoto <58775300+Shin-kyoto@users.noreply.github.com>

* feat(lidar_centerpoint): fix range in config for centerpoint

Signed-off-by: Shin-kyoto <58775300+Shin-kyoto@users.noreply.github.com>

* feat(lidar_centerpoint): fix the ranges and voxel size

Signed-off-by: Shin-kyoto <58775300+Shin-kyoto@users.noreply.github.com>

---------

Signed-off-by: Shin-kyoto <58775300+Shin-kyoto@users.noreply.github.com>

* Revert "fix: use centerpoint_tiny to centerpoint"

This reverts commit efcf726.

---------

Signed-off-by: yukke42 <yukke42@users.noreply.github.com>
Signed-off-by: yukke42 <yusuke.muramatsu@tier4.jp>
Signed-off-by: Shin-kyoto <58775300+Shin-kyoto@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
Co-authored-by: Shintaro Tomie <58775300+Shin-kyoto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants