cuda.bindings._v2.nvrtc.set_flow_callback#

cuda.bindings._v2.nvrtc.set_flow_callback(intptr_t prog, intptr_t callback, intptr_t payload)#

nvrtcSetFlowCallback registers a callback that the compiler invokes during compile_program().

The callback signature must be int callback(void *param1, void *param2). The compiler passes payload as param1 and NULL as param2 (reserved). Return 1 to cancel compilation, 0 to continue; the callback must return consistently, be thread-safe, and must not call any NVRTC/libnvvm/PTX APIs.

Pass callback as a raw C function-pointer integer (e.g. via ctypes.cast). Pass 0 for callback to clear a previously registered callback.

Parameters:
  • prog (intptr_t) – CUDA Runtime Compilation program.

  • callback (intptr_t) – C function pointer int (*)(void*, void*) cast to an integer, or 0 to clear.

  • payload (intptr_t) – Opaque pointer passed to the callback as its first argument.

See also

nvrtcSetFlowCallback