What is the purpose of launch and attach in compute-sanitizer

In general, I have the following question: is there a way I can attach compute-sanitizer to a running process to skip part of its execution? More precisely, can I sanitize a precisely specified range of code without the tool interrupt execution other than this chunk. I found compute-sanitizer has a launch option and an attach option. It seems to me that we can only attach to a process launched from compute-sanitizer --mode=launch, which to me, is no different from launch-and-attach. Can someone explain how to use launch and attach in more detail?

Hi, @Ziqi

The default mode is launch-and-attach.

  • launch-and-attach: Launch the target application and immediately attach.
  • launch: Launch the target application and suspend it, waiting for tool to attach.
  • attach: Attach to a previously launched application to which no other tool is attached.

Currently, compute-sanitizer doesn’t support attaching to an already-running process in the way traditional debuggers do. The --mode=launch starts the process under sanitizer control, and --mode=attach only works with processes started in --mode=launch and paused at a sync point. You can’t attach arbitrarily mid-execution.

To focus on specific code sections, instrument those sections with CUDA API calls like cudaDeviceSynchronize() and use selective kernel launch tagging or filters. This helps minimize overhead without skipping execution outside the target range.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.