.. _multi-target: Multi-Target ============ The multi-target feature enables debugging of multiple different targets in a single debugging session. With this feature, you can define breakpoints inside and outside the kernel to debug the host portion of the program. For example, define two breakpoints and run the target as follows: #. .. code-block:: bash break 56 Expected output: .. code-block:: bash Breakpoint 1 at 0x405800: file /path/to/array-transform.cpp, line 56. #. .. code-block:: bash break 83 Expected output: .. code-block:: bash Breakpoint 2 at 0x403e13: file /path/to/array-transform.cpp, line 83. #. .. code-block:: bash run gpu Expected output: .. code-block:: bash [...] [Switching to Thread 1.1073741824 lane 0] Thread 2.1 hit Breakpoint 1, with SIMD lanes [0-7], main::$_1::operator()[...] at array-transform.cpp:56 56 int element = in[index]; // breakpoint-here Now you are inside the kernel (in this case, the kernel is running on the GPU). The context is Thread 2.1, lane 0. Disable the breakpoint at line 56 and continue: .. code-block:: bash disable 1 .. code-block:: bash continue Expected output: .. code-block:: bash Continuing. [Switching to Thread 0x7ffff7fd9780 (LWP 19604)] Thread 1.1 "array-transform" hit Breakpoint 2, main (...) at /path/to/array-transform.cpp:83 83 cout << "success; result is correct.\n"; Try executing ``print input`` and ``print output`` as follows: - .. code-block:: bash print input[6] Expected output: .. code-block:: bash $1 = 106 - .. code-block:: bash print output[6] Expected output: .. code-block:: bash $2 = 206 This time the stop event is received from the host. The context is automatically switched to Thread 1.1. You can investigate the host-side values as shown above.