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

Use NVTX from GitHub. #15178

Merged
merged 15 commits into from
Mar 8, 2024
Merged

Conversation

bdice
Copy link
Contributor

@bdice bdice commented Feb 28, 2024

Description

This PR removes the vendored copy of NVTX and instead fetches it from GitHub.

Note: Consumers of libcudf internal detail headers will need to provide their own NVTX. This can be done by using the CMake code in this PR (or the sample CMake code in the NVTX README), and calling target_link_libraries(your_target PRIVATE nvtx3-cpp).

Closes #6476.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@github-actions github-actions bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels Feb 28, 2024
@bdice bdice added feature request New feature or request non-breaking Non-breaking change labels Feb 28, 2024
GIT_SHALLOW TRUE
DOWNLOAD_ONLY TRUE
)
set(NVTX_INCLUDE_DIR
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get the feeling that this is not the right way to do this. I think I need to add the nvtx targets, rather than specifying the include directory directly.

The targets are defined by c/CMakeLists.txt in the nvtx repo. I googled around a bit and tried to find how to add this. Do I need something like SOURCE_SUBDIR c for it to find the targets? I'm not sure how to use this.

cc: @robertmaynard @vyasr

Copy link
Contributor

Choose a reason for hiding this comment

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

Do I need something like SOURCE_SUBDIR c for it to find the targets?

Yes 🙂

https://github.com/NVIDIA/NVTX/tree/dev/c#use-cmake-package-manager-cpm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I tried this but wasn’t having success. I think that there is something I don’t understand about how rapids-cmake calls CPM.

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to use CPM _ARGS SOURCE_SUBDIR c to tell rapids-cmake to pass the option down to cpm.

Copy link
Contributor Author

@bdice bdice Feb 29, 2024

Choose a reason for hiding this comment

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

@robertmaynard I think I did that in 226101b. In my understanding, that should make the nvtx3-cpp target available, and I should be able to use target_link_libraries(cudf PRIVATE nvtx3-cpp) to get it to recognize the include directories from nvtx. However, this isn't working as I expected. Can you help me debug it?

@@ -777,7 +779,7 @@ add_dependencies(cudf jitify_preprocess_run)
target_link_libraries(
cudf
PUBLIC ${ARROW_LIBRARIES} CCCL::CCCL rmm::rmm
PRIVATE cuco::cuco ZLIB::ZLIB nvcomp::nvcomp kvikio::kvikio
PRIVATE nvtx3-cpp cuco::cuco ZLIB::ZLIB nvcomp::nvcomp kvikio::kvikio
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to also have the cudf tests use this target, since some tests are including internal cudf headers.

Copy link
Contributor Author

@bdice bdice Mar 4, 2024

Choose a reason for hiding this comment

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

@robertmaynard I had to do this for benchmarks, too. On second thought, should cudf be exporting this dependency somehow? Or do we expect every library using cudf to add nvtx3-cpp to their target_link_libraries?

(To be clear, I don't know the "right" way to solve this.)

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason that tests and benchmarks need to add the nvtx3-cpp target is that they include non 'publicheaders fromcudf/detail`.

Actual consumers of libcudf will not do so, and therefore have no need to have nvtx3 installed when building against libcudf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that makes sense. Thanks, I hadn’t considered that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For posterity, the JNI code was also consuming cudf detail headers and needed to link to NVTX.

@bdice bdice requested a review from robertmaynard March 5, 2024 15:18
@bdice bdice marked this pull request as ready for review March 5, 2024 15:18
@bdice bdice requested review from a team as code owners March 5, 2024 15:18
@bdice bdice requested a review from PointKernel March 5, 2024 15:18
@bdice bdice requested a review from a team as a code owner March 5, 2024 18:20
@github-actions github-actions bot added the Java Affects Java cuDF API. label Mar 5, 2024
Copy link
Member

@PointKernel PointKernel left a comment

Choose a reason for hiding this comment

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

Nice cleanups! 1925 lines removed 🔥 🔥 🔥

PR description to be updated otherwise looks great to me.

@harrism
Copy link
Member

harrism commented Mar 6, 2024

Consumers of libcudf internal detail headers will need to provide their own NVTX.

internal detail headers shouldn't consumed outside libcudf. :) If they are needed outside libcudf, a discussion about moving things out of detail should be started.

@bdice
Copy link
Contributor Author

bdice commented Mar 6, 2024

/merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CMake build issue feature request New feature or request Java Affects Java cuDF API. libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[FEA] Use official NVTX from GitHub
6 participants