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

refactor: add autoware_cuda_dependency_meta #10073

Merged
merged 4 commits into from
Mar 6, 2025

Conversation

esteve
Copy link
Contributor

@esteve esteve commented Feb 5, 2025

Description

Added meta package that packages that depend on CUDA must depend on.

Related links

Parent Issue:

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) component:system System design and integration. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) labels Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@esteve esteve added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Feb 5, 2025
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 26.39%. Comparing base (b3caa5c) to head (77ed72d).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10073      +/-   ##
==========================================
+ Coverage   26.31%   26.39%   +0.07%     
==========================================
  Files        1384     1389       +5     
  Lines      107560   107785     +225     
  Branches    41421    41515      +94     
==========================================
+ Hits        28306    28445     +139     
- Misses      76433    76503      +70     
- Partials     2821     2837      +16     
Flag Coverage Δ *Carryforward flag
differential 4.55% <ø> (?)
differential-cuda 4.35% <ø> (?)
total 26.39% <ø> (+0.07%) ⬆️ Carriedforward from fbc7a9d

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@esteve esteve force-pushed the add-cuda-deps branch 2 times, most recently from 305f2ac to 9e8c5a5 Compare February 12, 2025 11:59
@xmfcx
Copy link
Contributor

xmfcx commented Feb 18, 2025

Hi @esteve thanks for working on this task, is this ready for review? Are there any blockers?

@esteve
Copy link
Contributor Author

esteve commented Feb 19, 2025

@xmfcx I'm testing this in our buildfarm to make sure packages that depend on autoware_cuda_dependency_meta can be filtered out easily.

@esteve
Copy link
Contributor Author

esteve commented Mar 3, 2025

This PR is now ready for review, the buildfarm builds fine when excluding the autoware_cuda_dependency_meta autowarefoundation/autoware-deb-packages#127

@esteve esteve force-pushed the add-cuda-deps branch 2 times, most recently from f6af636 to 4d3318e Compare March 3, 2025 09:10
@esteve
Copy link
Contributor Author

esteve commented Mar 3, 2025

@xmfcx this PR requires approvals from 15 people, would it be possible to merge it with only one or two? I worry it might take too long if we have to wait for 15. Thanks.

Copy link
Contributor

@amadeuszsz amadeuszsz left a comment

Choose a reason for hiding this comment

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

LGTM!
I'm not only sure if for new packages we should align package version in package.xml with latest tag. Nevertheless, new release will overwrite it.

@knzo25
Copy link
Contributor

knzo25 commented Mar 3, 2025

@esteve
Can you add this package as well?
https://github.com/autowarefoundation/autoware.universe/blob/main/perception/autoware_probabilistic_occupancy_grid_map/CMakeLists.txt

Or rather, a question:
The previous package contains, say, 2 different nodes that share some logic.
One needs cuda and will not be built if there is no nvcc. The other one does not need cuda so will be built no matter what.
Should we use the meta dependency in this case?

@github-actions github-actions bot removed the component:system System design and integration. (auto-assigned) label Mar 4, 2025
@esteve
Copy link
Contributor Author

esteve commented Mar 4, 2025

@knzo25 if the package depends on CUDA in one way or another, yes, it must depend on autoware_cuda_dependency_meta, even if some of its components can be built without CUDA. Eventually we want to add REQUIRED to find_package(CUDA) for those packages that depend on CUDA to make the dependency clear and so that builds fail if CUDA is not available.

@esteve
Copy link
Contributor Author

esteve commented Mar 4, 2025

@knzo25 I've added autoware_cuda_dependency_meta to autoware_probabilistic_occupancy_grid_map in 88ef5c0

@xmfcx
Copy link
Contributor

xmfcx commented Mar 5, 2025

$ colcon list --base-paths src/universe/autoware.universe --packages-above autoware_tensorrt_common autoware_cuda_utils --names-only
autoware_bytetrack
autoware_cuda_utils
autoware_detected_object_validation
autoware_detection_by_tracker
autoware_image_projection_based_fusion
autoware_lidar_apollo_instance_segmentation
autoware_lidar_centerpoint
autoware_lidar_transfusion
autoware_probabilistic_occupancy_grid_map
autoware_raindrop_cluster_filter
autoware_shape_estimation
autoware_tensorrt_classifier
autoware_tensorrt_common
autoware_tensorrt_yolox
autoware_traffic_light_classifier
autoware_traffic_light_fine_detector
tier4_perception_launch
tier4_simulator_launch

Many packages are missing this dependency. Could you update them?

colcon graph --packages-above autoware_cuda_utils autoware_tensorrt_common --dot | dot -Tsvg -Grankdir=LR -Gnodesep=0.2 -Granksep=0.3 -Gconcentrate=true -o graph.svg

graph


Or rather, a question:
The autoware_probabilistic_occupancy_grid_map contains, say, 2 different nodes that share some logic.
One needs cuda and will not be built if there is no nvcc. The other one does not need cuda so will be built no matter what.
Should we use the meta dependency in this case?

@knzo25 I'd suggest that we should not allow partial dependency for cuda for packages. A package should either depend on it or not.

And the building behavior set in CMakeLists.txt should reflect that.

If a node out of this package needs to be used in a non-cuda environment, it should be separated into another package.

But until that happens, we will treat the entire package as a cuda package.

@knzo25
Copy link
Contributor

knzo25 commented Mar 5, 2025

@xmfcx
I agree with that and for new nodes I am trying hard to separate implementations without duplicating code (what will happen in the concat vs cuda concat).
For the OGM we really needed to acelerate it so I cuda-fied it. Then we got complains that some people needed to run one version (the one that is not heavy) in environments without cuda so I modified the cmake to allow for that 😢

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

Copy link
Contributor

@xmfcx xmfcx left a comment

Choose a reason for hiding this comment

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

About 6 packages are missing the dependency.

I'm slightly conflicted about <exec_depend>ency. I think we can exclude them?

@esteve
Copy link
Contributor Author

esteve commented Mar 5, 2025

@xmfcx

Many packages are missing this dependency. Could you update them?

I don't see why those packages should depend on autoware_cuda_dependency_meta, the rationale for the package as a I understood it is that if they depend on CUDA directly, then they need to depend on autoware_cuda_dependency_meta. Otherwise, if we're just filtering out packages that depend on autoware_tensorrt_common and autoware_cuda_utils, then I don't see the point of autoware_cuda_dependency_meta itself, when we can just filter out via those.

@xmfcx @mitsudome-r @youtalk Could we clarify this? Thanks.

@xmfcx
Copy link
Contributor

xmfcx commented Mar 5, 2025

Right, I got confused when you said:

if the package depends on CUDA in one way or another, yes, it must depend on autoware_cuda_dependency_meta, even if some of its components can be built without CUDA.

I thought you've already added some packages that depended on CUDA indirectly. Sorry, for my misunderstanding🙇‍♂️.

I've also stated in the original issue to add only direct dependencies so I'm in line with you 👍

autoware_bytetrack also depends on CUDA to build I guess, at least it is using some CUDA related parameters in its cmakelists file.

@xmfcx
Copy link
Contributor

xmfcx commented Mar 5, 2025

CMakeLists has tensorrt version variable passed to it, gray area?:

  • autoware_bytetrack

Indirectly dependent on CUDA packages:

  • autoware_detected_object_validation
  • autoware_detection_by_tracker
  • autoware_raindrop_cluster_filter
  • tier4_perception_launch
  • tier4_simulator_launch

The rest are directly dependent and the deps are added within this PR ✅

@esteve
Copy link
Contributor Author

esteve commented Mar 5, 2025

autoware_bytetrack also depends on CUDA to build I guess, at least it is using some CUDA related parameters in its cmakelists file.

You're right, I missed that one. Basically what I did was to grep -ri find_package(CUDA and add autoware_cuda_dependency_meta as a dependency in package.xml, but forgot to check for TensorRT. I'll add the dependency to autoware_bytetrack

esteve added 4 commits March 5, 2025 15:49
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
@xmfcx xmfcx merged commit 3b0f98e into autowarefoundation:main Mar 6, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants