Skip to content

Commit

Permalink
Use NVTX from GitHub. (#15178)
Browse files Browse the repository at this point in the history
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](https://github.com/NVIDIA/NVTX?tab=readme-ov-file#cmake)), and calling `target_link_libraries(your_target PRIVATE nvtx3-cpp)`.

Closes #6476.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Yunsong Wang (https://github.com/PointKernel)
  - Nghia Truong (https://github.com/ttnghia)
  - Robert Maynard (https://github.com/robertmaynard)

URL: #15178
  • Loading branch information
bdice authored Mar 8, 2024
1 parent c9e54cf commit dc42182
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 1,926 deletions.
4 changes: 3 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ endif()
rapids_cpm_init()
# find jitify
include(cmake/thirdparty/get_jitify.cmake)
# find NVTX
include(cmake/thirdparty/get_nvtx.cmake)
# find nvCOMP
include(cmake/thirdparty/get_nvcomp.cmake)
# find CCCL before rmm so that we get cudf's patched version of CCCL
Expand Down Expand Up @@ -776,7 +778,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
$<TARGET_NAME_IF_EXISTS:cuFile_interface>
)

Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_compile_options(
target_link_libraries(
cudf_datagen
PUBLIC GTest::gmock GTest::gtest benchmark::benchmark nvbench::nvbench Threads::Threads cudf
cudftestutil
cudftestutil nvtx3-cpp
PRIVATE $<TARGET_NAME_IF_EXISTS:conda_env>
)

Expand Down
27 changes: 27 additions & 0 deletions cpp/cmake/thirdparty/get_nvtx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# =============================================================================
# Copyright (c) 2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================

# This function finds NVTX and sets any additional necessary environment variables.
function(find_and_configure_nvtx)
rapids_cpm_find(
NVTX3 3.1.0
GLOBAL_TARGETS nvtx3-c nvtx3-cpp
CPM_ARGS
GIT_REPOSITORY https://github.com/NVIDIA/NVTX.git
GIT_TAG v3.1.0
GIT_SHALLOW TRUE SOURCE_SUBDIR c
)
endfunction()

find_and_configure_nvtx()
4 changes: 2 additions & 2 deletions cpp/doxygen/developer_guide/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,11 @@ defaults.
## NVTX Ranges

In order to aid in performance optimization and debugging, all compute intensive libcudf functions
should have a corresponding NVTX range. Choose between `CUDF_FUNC_RANGE` or `cudf::thread_range`
should have a corresponding NVTX range. Choose between `CUDF_FUNC_RANGE` or `cudf::scoped_range`
for declaring NVTX ranges in the current scope:
- Use the `CUDF_FUNC_RANGE()` macro if you want to use the name of the function as the name of the
NVTX range
- Use `cudf::thread_range rng{"custom_name"};` to provide a custom name for the current scope's
- Use `cudf::scoped_range rng{"custom_name"};` to provide a custom name for the current scope's
NVTX range

For more information about NVTX, see [here](https://github.com/NVIDIA/NVTX/tree/dev/c).
Expand Down
Loading

0 comments on commit dc42182

Please sign in to comment.