cuda.bindings._v2.driver.checkpoint_process_checkpoint#
- cuda.bindings._v2.driver.checkpoint_process_checkpoint(int pid, args)#
Checkpoint a CUDA process’s GPU memory contents.
Checkpoints a CUDA process specified by
pid. The GPU memory contents will be brought into host memory or mapped onto the calling process’s GPUs for user- defined behavior. Underlying GPU references are released when checkpointing completes. The process must be in theCU_PROCESS_STATE_LOCKEDstate to checkpoint. WhenCUcheckpointCheckpointArgs.customStorageInfo_outis not NULL, all the GPU memory allocated by the process withpidwill be mapped onto the calling process’s GPUs so the application can copy the memory to custom storage. Upon return of this call, the pointer referenced byCUcheckpointCheckpointArgs.customStorageInfo_outwill point to aCUcheckpointCustomStorageInfostruct allocated and populated by the driver. For each GPU which contains data from the checkpointed process, there is a corresponding entry in theCUcheckpointCustomStoragePerDeviceDataarray.The device pointers and sizes for the contiguously mapped memory on a particular GPU are set in the
CUcheckpointCustomStoragePerDeviceData.devPtrandCUcheckpointCustomStoragePerDeviceData.sizefields respectively.A stream belonging to the primary context of a particular GPU is set in
CUcheckpointCustomStoragePerDeviceData.stream. The application can use the stream to find out which GPU the memory is mapped on and to enqueue the copies to custom storage.
The application is responsible for copying the mapped data from the GPU at the specified device address to custom storage. When checkpointing to custom storage, the application is expected to call
cuCheckpointOperationComplete. TheCUcheckpointCustomStorageInfo.handleset by this call should be passed tocuCheckpointOperationCompleteinhandle. The driver synchronizes all the streams incuCheckpointOperationComplete, at which point the copy to custom storage is considered complete. When checkpointing to custom storage, the application is expected to retain primary contexts of all the devices used by the process to be checkpointed. OtherwisecuCheckpointProcessCheckpointwill returnCUDA_ERROR_INVALID_CONTEXT. Unlike other checkpoint operations, checkpointing to custom storage requirescuInitto have been called before execution. Checkpointing the calling process’s GPU memory to custom storage is not supported. Upon successful return, the target process will be in theCU_PROCESS_STATE_CHECKPOINTINGstate. WhenCUcheckpointCheckpointArgs.customStorageInfo_outis NULL, the GPU memory contents will be brought into host memory bycuCheckpointProcessCheckpoint. The application is not expected to copy the GPU memory contents. The application is also not expected to callcuCheckpointOperationComplete. Upon successful return, the target process will be in theCU_PROCESS_STATE_CHECKPOINTEDstate.- Parameters:
pid (int) – The process ID of the CUDA process.
args (intptr_t) – Optional checkpoint operation arguments.
See also
cuCheckpointProcessCheckpoint