Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need to put
${CUDAToolkit_INCLUDE_DIRS}
on line 19 as an extra hint to search include?CMAKE_PREFIX_PATH
takes the root dir and appendbin
,lib
, orinclude
for the appropriate search: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my system, setting
NVTX_ROOT
properly seems to have already done the trick.Would you say that adding this extra hint would help even more (on other systems)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CMake 3.12+ (we require 3.13 now), setting
<package>_ROOT
correctly should be sufficient forfind_path
: https://cmake.org/cmake/help/latest/command/find_path.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It potentially ends up to be the same but
CMAKE_PREFIX_PATH
is usually used for the parent (root
) directory instead of the subdirinclude
.<PackageName>_ROOT
is used in the same way. Specific subdir (bin
/lib
/include
) hints are usually added to the correspondingfind_*
HINTS
argument.On my container
CUDAToolkit_LIBRARY_ROOT
is empty, which is weird, so relying onCUDAToolkit_INCLUDE_DIRS
instead seems to be a good idea, but maybe it is set in some cases?I would just have added
CUDAToolkit_INCLUDE_DIRS
to the find_path:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end as you mentioned it works in both cases and here we seem to only need to search for just the include of nvtx. Out of curiosity, do you know why we don't need to find the nvtx lib too
libnvToolsExt.so
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, understood. It would probably be clearer not to plug
CUDAToolkit_INCLUDE_DIRS
intoNVTX_ROOT
(although it works for us as we don't need the.so
).The Nsight Systems User Guide only speaks of the header file: https://docs.nvidia.com/nsight-systems/UserGuide/index.html#nvtx-trace Might it be necessary to explicitly link that library for use cases where one does not attach that profiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact we are using the nvtx header-only library, so the shared lib is never needed:
https://gitlab.kitware.com/cmake/cmake/-/issues/21377
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with your suggestion, @nvcastet, there's no need to deal with the
NVTX_ROOT
variable at all here.