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

Fix RAFT_NVTX option not set #4825

Merged
merged 2 commits into from
Jul 27, 2022

Conversation

achirkin
Copy link
Contributor

Pass NVTX option to raft in a more similar way to the other arguments and make sure RAFT_NVTX option in the installed raft-config.cmake.

@achirkin achirkin requested a review from a team as a code owner July 21, 2022 13:20
@achirkin
Copy link
Contributor Author

Another alternative to this would be to just rename NVTX option in CMakeLists.txt to RAFT_NVTX.

@achirkin achirkin added bug Something isn't working non-breaking Non-breaking change labels Jul 21, 2022
@cjnolet
Copy link
Member

cjnolet commented Jul 25, 2022

rerun tests

@@ -62,7 +66,7 @@ function(find_and_configure_raft)
"RAFT_COMPILE_NN_LIBRARY ${PKG_USE_RAFT_NN}"
"RAFT_COMPILE_DIST_LIBRARY ${PKG_USE_RAFT_DIST}"
"RAFT_USE_FAISS_STATIC ${PKG_USE_FAISS_STATIC}"
"RAFT_NVTX ${NVTX}"
"RAFT_NVTX ${PKG_NVTX}"
Copy link
Member

Choose a reason for hiding this comment

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

@robertmaynard, hoping you might have an idea of why this doesn't seem to be turning on the option in RAFT. @achirkin mentioned that the explicit set(RAFT_NVTX ON) is needed in order for the RAFT to pick up the option.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should not pass it as an argument to the find, but only set it before hand. I recommend this approach:

@@ -45,11 +45,11 @@ function(find_and_configure_raft)
         set(RAFT_COMPILE_LIBRARIES OFF)
     endif()
 
-    message(VERBOSE "CUML: raft FIND_PACKAGE_ARGUMENTS COMPONENTS ${RAFT_COMPONENTS}")
+    # We need to set this each time so that on subsequent calls to cmake
+    # the raft-config.cmake re-evaluates the RAFT_NVTX value
+    set(RAFT_NVTX ${PKG_NVTX})
 
-    if(PKG_NVTX)
-      set(RAFT_NVTX ON)
-    endif()
+    message(VERBOSE "CUML: raft FIND_PACKAGE_ARGUMENTS COMPONENTS ${RAFT_COMPONENTS}")
 
     rapids_cpm_find(raft ${PKG_VERSION}
             GLOBAL_TARGETS      raft::raft
@@ -66,7 +66,6 @@ function(find_and_configure_raft)
               "RAFT_COMPILE_NN_LIBRARY ${PKG_USE_RAFT_NN}"
               "RAFT_COMPILE_DIST_LIBRARY ${PKG_USE_RAFT_DIST}"
               "RAFT_USE_FAISS_STATIC ${PKG_USE_FAISS_STATIC}"
-              "RAFT_NVTX ${PKG_NVTX}"
     )
 
     if(raft_ADDED)

The issue is around using an existing version of raft ( from conda ) and changing the value of RAFT_NVTX for multiple invocations of cmake. After the first invocation of CMake, rapids has been found and the arguments to rapids_cpm_find are not used anymore.

So to consistently support NVTX values changing we want to set it as a local variable so that the following raft-config.cmake logic always sees it: https://github.com/rapidsai/raft/blob/branch-22.08/cpp/CMakeLists.txt#L206

Copy link
Member

Choose a reason for hiding this comment

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

Ah ha, that totally makes sense. Thanks for explaining!

Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

I think it would be better, while we are already making changes to get_raft.cmake, to remove the RAFT_NVTX argument from rapids_cpm_find altogether (per Robert Maynard's suggesiton).

@codecov-commenter
Copy link

Codecov Report

Merging #4825 (b2e51ae) into branch-22.08 (97941e3) will not change coverage.
The diff coverage is n/a.

@@              Coverage Diff              @@
##           branch-22.08    #4825   +/-   ##
=============================================
  Coverage         77.62%   77.62%           
=============================================
  Files               180      180           
  Lines             11384    11384           
=============================================
  Hits               8837     8837           
  Misses             2547     2547           
Flag Coverage Δ
dask 45.52% <ø> (ø)
non-dask 67.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97941e3...b2e51ae. Read the comment docs.

@cjnolet
Copy link
Member

cjnolet commented Jul 27, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 75fe7d5 into rapidsai:branch-22.08 Jul 27, 2022
jakirkham pushed a commit to jakirkham/cuml that referenced this pull request Feb 27, 2023
Pass `NVTX` option to raft in a more similar way to the other arguments and make sure `RAFT_NVTX` option in the installed `raft-config.cmake`.

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)
  - Robert Maynard (https://github.com/robertmaynard)

URL: rapidsai#4825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CMake CUDA/C++ non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants