Skip to content

Commit

Permalink
cuda: fix bookkeeping events
Browse files Browse the repository at this point in the history
  • Loading branch information
bd4 committed Jun 13, 2024
1 parent 870abfd commit 6488701
Showing 1 changed file with 48 additions and 7 deletions.
55 changes: 48 additions & 7 deletions xprof/xprof.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -492,16 +492,55 @@ end

def enable_events_cuda(channel_name, tracing_mode: 'default', profiling: true)
lttng_enable_bookkeeping = "lttng enable-event --userspace --session=#{lttng_session_uuid_bookkeeping} --channel=#{channel_name}"
required_events = [
"lttng_ust_cuda:cuGetProcAddress_v2_entry",
"lttng_ust_cuda:cuGetProcAddress_v2_exit",
].join(',')
#"lttng_ust_cuda:cuGetExportTable_entry",
#"lttng_ust_cuda:cuGetExportTable_exit"
#"lttng_ust_cuda:cuGetProcAddress_v2_entry",
#"lttng_ust_cuda:cuGetProcAddress_v2_exit",
#"lttng_ust_cuda:cuDeviceGetCount_entry",
#"lttng_ust_cuda:cuDeviceGetCount_exit",
#"lttng_ust_cuda:cuDeviceGet_entry",
#"lttng_ust_cuda:cuDeviceGet_exit",
#"lttng_ust_cuda:cuDeviceGetName_entry",
#"lttng_ust_cuda:cuDeviceGetName_exit",
bookkeeping_events = [
"lttng_ust_cuda:cuCtx*",
"lttng_ust_cuda:cuDevicePrimaryCtxRetain",
"lttng_ust_cuda:cuStreamCreate",
"lttng_ust_cuda:cuModuleGetFunction"
"lttng_ust_cuda:cuCtxCreate_entry",
"lttng_ust_cuda:cuCtxCreate_exit",
"lttng_ust_cuda:cuCtxCreate_v2_entry",
"lttng_ust_cuda:cuCtxCreate_v2_exit",
"lttng_ust_cuda:cuCtxCreate_v3_entry",
"lttng_ust_cuda:cuCtxCreate_v3_exit",
"lttng_ust_cuda:cuCtxDestroy_entry",
"lttng_ust_cuda:cuCtxDestroy_exit",
"lttng_ust_cuda:cuCtxDestroy_v2_entry",
"lttng_ust_cuda:cuCtxDestroy_v2_exit",
"lttng_ust_cuda:cuCtxSetCurrent_entry",
"lttng_ust_cuda:cuCtxSetCurrent_exit",
"lttng_ust_cuda:cuCtxPushCurrent_entry",
"lttng_ust_cuda:cuCtxPushCurrent_exit",
"lttng_ust_cuda:cuCtxPushCurrent_v2_entry",
"lttng_ust_cuda:cuCtxPushCurrent_v2_exit",
"lttng_ust_cuda:cuCtxPopCurrent_entry",
"lttng_ust_cuda:cuCtxPopCurrent_exit",
"lttng_ust_cuda:cuCtxPopCurrent_v2_entry",
"lttng_ust_cuda:cuCtxPopCurrent_v2_exit",
"lttng_ust_cuda:cuDevicePrimaryCtxRetain_entry",
"lttng_ust_cuda:cuDevicePrimaryCtxRetain_exit",
"lttng_ust_cuda:cuStreamCreate_entry",
"lttng_ust_cuda:cuStreamCreate_exit",
"lttng_ust_cuda:cuStreamCreateWithPriority_entry",
"lttng_ust_cuda:cuStreamCreateWithPriority_exit",
"lttng_ust_cuda:cuModuleGetFunction_entry",
"lttng_ust_cuda:cuModuleGetFunction_exit"
].join(',')
exec("#{lttng_enable_bookkeeping} #{bookkeeping_events}")
exec("#{lttng_enable_bookkeeping} #{bookkeeping_events},#{required_events}")

lttng_enable = "lttng enable-event --userspace --session=#{lttng_session_uuid} --channel=#{channel_name}"
exec("#{lttng_enable} lttng_ust_cuda:* -x #{bookkeeping_events}")
exec("#{lttng_enable} #{required_events}")
exec("#{lttng_enable} lttng_ust_cuda_properties")
exec("#{lttng_enable} lttng_ust_cuda_profiling:*") if profiling
end
Expand Down Expand Up @@ -613,10 +652,12 @@ def on_node_processing(backends, syncd)
opts << "--output #{thapi_trace_dir_tmp}"
opts << "--backends #{backends.join(',')}"
exec("#{BINDIR}/babeltrace_thapi #{opts.join(' ')} -- #{lttng_trace_dir_tmp}")
FileUtils.rm_f(lttng_trace_dir_tmp)
#FileUtils.rm_f(lttng_trace_dir_tmp)
LOGGER.info("tmpdir #{lttng_trace_dir_tmp}")
else
FileUtils.mkdir_p(File.dirname(thapi_trace_dir_tmp))
exec("mv #{lttng_trace_dir_tmp} #{thapi_trace_dir_tmp}")
exec("cp -rp #{lttng_trace_dir_tmp} #{thapi_trace_dir_tmp}")
LOGGER.info("tmpdir #{lttng_trace_dir_tmp}")
end

# Global Barrier
Expand Down

0 comments on commit 6488701

Please sign in to comment.