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

Use CUDF_JNI_ENABLE_PROFILING to conditionally enable profiling support. #12221

Merged
merged 5 commits into from
Nov 28, 2022

Conversation

bdice
Copy link
Contributor

@bdice bdice commented Nov 22, 2022

Description

The conda cudatoolkit packages do not include <cuda_profiler_api.h>. This PR makes CUDA profiling (introduced in #9543) optional in the JNI layer. By default, profiling will be enabled. In GitHub Actions (#12002), profiling will be disabled.

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 CMake CMake build issue Java Affects Java cuDF API. labels Nov 22, 2022
@@ -87,6 +88,10 @@ if(CUDF_USE_PER_THREAD_DEFAULT_STREAM)
add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM CUDF_USE_PER_THREAD_DEFAULT_STREAM)
endif()

if(CUDF_JNI_ENABLE_PROFILING)
target_compile_definitions(cudfjni PUBLIC CUDF_JNI_ENABLE_PROFILING)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rapidsai/rapids-cmake-codeowners Can someone look at this CMake? Do I need a value here or something like "CUDF_JNI_ENABLE_PROFILING=1"? I don't feel super confident in this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a CMake expert, but this looks correct to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the build failure, I think this should be add_compile_definitions like the code just above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am going to push a fix for this shortly. I think this CMake file has some issues. We should prefer target_compile_definitions to keep the scope limited, but add_library(cudfjni) occurs lower in the script. All target_compile_definitions must happen after the library is defined. This is also an issue for USE_NVTX, which I was using as an example. I am guessing that we have not recently tested the build with that option turned off.

Copy link
Contributor

Choose a reason for hiding this comment

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

both CUDF_JNI_ENABLE_PROFILING and CUDF_JNI_ENABLE_PROFILING=1 are valid. It depends on if you want to define a name or a name with value.

#define CUDF_JNI_ENABLE_PROFILING 
// versus
#define CUDF_JNI_ENABLE_PROFILING 1

Copy link
Contributor

Choose a reason for hiding this comment

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

But yes this needs to go after the construction of the target cudfjni

@abellina
Copy link
Contributor

The JNI side of this looks great, I am not too sure on the CMake side of things either.

@bdice bdice marked this pull request as ready for review November 22, 2022 15:20
@bdice bdice requested a review from a team as a code owner November 22, 2022 15:20
@bdice bdice added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Nov 22, 2022
@bdice bdice requested a review from a team November 22, 2022 15:20
Copy link
Contributor

@jbrennan333 jbrennan333 left a comment

Choose a reason for hiding this comment

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

+1 this looks good to me

@@ -87,6 +88,10 @@ if(CUDF_USE_PER_THREAD_DEFAULT_STREAM)
add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM CUDF_USE_PER_THREAD_DEFAULT_STREAM)
endif()

if(CUDF_JNI_ENABLE_PROFILING)
target_compile_definitions(cudfjni PUBLIC CUDF_JNI_ENABLE_PROFILING)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a CMake expert, but this looks correct to me.

@abellina
Copy link
Contributor

JNI build failed on:

08:13:45 [exec] CMake Error at CMakeLists.txt:92 (target_compile_definitions):
08:13:45 [exec] Cannot specify compile definitions for target "cudfjni" which is not built
08:13:45 [exec] by this project.

@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

❗ No coverage uploaded for pull request base (branch-23.02@d49e412). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Current head 91c91b2 differs from pull request most recent head f0dbc5b. Consider uploading reports for the commit f0dbc5b to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##             branch-23.02   #12221   +/-   ##
===============================================
  Coverage                ?   88.19%           
===============================================
  Files                   ?      137           
  Lines                   ?    22660           
  Branches                ?        0           
===============================================
  Hits                    ?    19984           
  Misses                  ?     2676           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bdice bdice self-assigned this Nov 27, 2022
@bdice bdice requested a review from robertmaynard November 28, 2022 01:29
@bdice bdice requested a review from robertmaynard November 28, 2022 17:22
@bdice
Copy link
Contributor Author

bdice commented Nov 28, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 3bf6d1d into rapidsai:branch-23.02 Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CMake build issue improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants