Skip to content

Use NVTX from GitHub. - #15178

Merged
rapids-bot[bot] merged 15 commits into
NVIDIA:branch-24.04from
bdice:use-nvtx3-upstream
Mar 8, 2024
Merged

rapids-bot[bot] merged 15 commits into
NVIDIA:branch-24.04from
bdice:use-nvtx3-upstream

Conversation

@bdice

@bdice bdice commented Feb 28, 2024 •

Copy link
Copy Markdown
Contributor

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
Comment thread cpp/cmake/thirdparty/get_nvtx.cmake Outdated
GIT_SHALLOW TRUE
DOWNLOAD_ONLY TRUE
)
set(NVTX_INCLUDE_DIR

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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.

@bdice bdice Feb 29, 2024 •

Copy link
Copy Markdown
Contributor Author

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?

Comment thread cpp/include/cudf/detail/nvtx/ranges.hpp Resolved
Comment thread cpp/cmake/thirdparty/get_nvtx.cmake Resolved
Comment thread cpp/CMakeLists.txt
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
Copy Markdown
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.

@bdice bdice Mar 4, 2024 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Comment thread cpp/include/cudf/detail/nvtx/ranges.hpp Resolved

@PointKernel PointKernel left a comment

Copy link
Copy Markdown
Member

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

harrism commented Mar 6, 2024

Copy link
Copy Markdown
Contributor

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

bdice commented Mar 6, 2024

Copy link
Copy Markdown
Contributor Author

/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

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] Use official NVTX from GitHub

6 participants