Skip to content

Add NVTX range in CUDA GPU kernel call of program #1986

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dace/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ if(DACE_ENABLE_CUDA)

set(CMAKE_CUDA_ARCHITECTURES "${LOCAL_CUDA_ARCHITECTURES}")
enable_language(CUDA)
list(APPEND DACE_LIBS CUDA::cudart)
list(APPEND DACE_LIBS CUDA::cudart CUDA::nvtx3)
add_definitions(-DWITH_CUDA)

if (MSVC_IDE)
Expand Down
8 changes: 8 additions & 0 deletions dace/codegen/targets/framecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def generate_fileheader(self, sdfg: SDFG, global_stream: CodeIOStream, backend:
if backend == 'frame':
global_stream.write('#include "../../include/hash.h"\n', sdfg)

global_stream.write('#ifdef WITH_CUDA\n#include <nvtx3/nvToolsExt.h>\n#endif\n', sdfg)

#########################################################
# Environment-based includes
for env in self.environments:
Expand Down Expand Up @@ -266,7 +268,13 @@ def generate_footer(self, sdfg: SDFG, global_stream: CodeIOStream, callsite_stre
f'''
DACE_EXPORTED void __program_{fname}({mangle_dace_state_struct_name(fname)} *__state{params_comma})
{{
#ifdef WITH_CUDA
nvtxRangePushA("{fname}");
#endif
__program_{fname}_internal(__state{paramnames_comma});
#ifdef WITH_CUDA
nvtxRangePop();
#endif
}}''', sdfg)

for target in self._dispatcher.used_targets:
Expand Down