Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/timemory/cmake/Modules/FindNVTX.cmake
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

109 lines
3.8 KiB
CMake

# Try to find the NVTX library and headers Usage of this module is as follows
#
# find_package( NVTX ) if(NVTX_FOUND) include_directories(${NVTX_INCLUDE_DIRS})
# add_executable(foo foo.cc) target_link_libraries(foo ${NVTX_LIBRARIES}) endif()
#
# ===========================================================================
# Variables used by this module which can be used to change the default behaviour, and
# hence need to be set before calling find_package:
#
# NVTX_ROOT_DIR The preferred installation prefix for searching for NVTX Set this if the
# module has problems finding the proper NVTX installation.
#
# If you don't supply NVTX_ROOT_DIR, the module will search on the standard system paths.
#
# ============================================================================
# Variables set by this module:
#
# NVTX_FOUND System has NVTX.
#
# NVTX_INCLUDE_DIRS NVTX include directories: not cached.
#
# NVTX_LIBRARIES Link to these to use the NVTX library: not cached.
#
# ===========================================================================
# If NVTX is installed in a non-standard way, e.g. a non GNU-style install of
# <prefix>/{lib,include}, then this module may fail to locate the headers and libraries as
# needed. In this case, the following cached variables can be editted to point to the
# correct locations.
#
# NVTX_INCLUDE_DIR The path to the NVTX include directory: cached
#
# NVTX_LIBRARY The path to the NVTX library: cached
#
# You should not need to set these in the vast majority of cases
#
# ----------------------------------------------------------------------------------------#
find_path(
NVTX_ROOT_DIR
NAMES include/nvtx3/nvToolsExt.h
HINTS ENV NVTX_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} ${CUDA_SDK_ROOT_DIR} /usr/local/cuda
PATHS ENV NVTX_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} ${CUDA_SDK_ROOT_DIR} /usr/local/cuda
PATH_SUFFIXES targets/x86_64-linux targets/x86_64-darwin targets/x86_64-win32
targets/x86_64-win64
DOC "NVTX root installation directory")
# ----------------------------------------------------------------------------------------#
find_path(
NVTX_INCLUDE_DIR
NAMES nvtx3/nvToolsExt.h
HINTS ${NVTX_ROOT_DIR} ENV NVTX_ROOT_DIR ENV CPATH
PATH_SUFFIXES include
DOC "Path to the NVTX headers")
# ----------------------------------------------------------------------------------------#
find_library(
NVTX_LIBRARY
NAMES nvToolsExt
PATHS ${NVTX_ROOT_DIR}
ENV
NVTX_ROOT_DIR
${CUDA_TOOLKIT_ROOT_DIR}
${CUDA_SDK_ROOT_DIR}
/usr/local/cuda
ENV
LIBRARY_PATH
ENV
LD_LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
HINTS ${NVTX_ROOT_DIR}
ENV
NVTX_ROOT_DIR
${CUDA_TOOLKIT_ROOT_DIR}
${CUDA_SDK_ROOT_DIR}
/usr/local/cuda
ENV
LIBRARY_PATH
ENV
LD_LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
PATH_SUFFIXES lib lib64
DOC "Path to the NVTX library")
# ----------------------------------------------------------------------------------------#
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set NVTX_FOUND to TRUE if all listed
# variables are TRUE
find_package_handle_standard_args(NVTX DEFAULT_MSG NVTX_INCLUDE_DIR)
# ----------------------------------------------------------------------------------------#
if(NVTX_FOUND)
add_library(nvtx INTERFACE)
target_include_directories(nvtx INTERFACE ${NVTX_INCLUDE_DIR})
get_filename_component(NVTX_INCLUDE_DIRS ${NVTX_INCLUDE_DIR} REALPATH)
if(NVTX_LIBRARY)
target_link_libraries(nvtx INTERFACE ${NVTX_LIBRARY})
get_filename_component(NVTX_LIBRARIES ${NVTX_LIBRARY} REALPATH)
endif()
endif()
mark_as_advanced(NVTX_INCLUDE_DIR NVTX_LIBRARY)