cuda.bindings._v2.driver.checkpoint_process_restore#
- cuda.bindings._v2.driver.checkpoint_process_restore(int pid, args)#
Restore a CUDA process’s GPU memory contents from its last checkpoint.
Restores a CUDA process specified by
pidfrom its last checkpoint. Process must be in theCU_PROCESS_STATE_CHECKPOINTEDstate to restore. GPU UUID pairs can be specified inargsto remap the process old GPUs onto new GPUs. The GPU to restore onto needs to have enough memory and be of the same chip type as the old GPU. If an array of GPU UUID pairs is specified, it must contain every checkpointed GPU. CUDA process restore requires persistence mode to be enabled orcuInitto have been called before execution. WhenCUcheckpointRestoreArgs.customStorageInfo_outis not NULL, all the GPU memory to be restored for the process withpidwill be mapped onto the calling process’s GPUs so the application can copy the memory back to the GPU. Upon return of this call, the pointer referenced byCUcheckpointRestoreArgs.customStorageInfo_outwill point to aCUcheckpointCustomStorageInfostruct allocated and populated by the driver. For each GPU which contains data from the restored 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 the 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 from custom storage back to the GPU.
The application is responsible for copying the data from custom storage to the GPU at the specified device address. When restoring from 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 from custom storage is considered complete. When restoring from custom storage, the application is expected to retain primary contexts of all the devices used by the process to be restored. OtherwisecuCheckpointProcessRestorewill returnCUDA_ERROR_INVALID_CONTEXT. Restoring the calling process’s GPU memory from custom storage is not supported. Upon successful return, the target process will be in theCU_PROCESS_STATE_RESTORINGstate. WhenCUcheckpointRestoreArgs.customStorageInfo_outis NULL, the GPU memory contents will be restored from host memory bycuCheckpointProcessRestore. The application is not expected to copy back the GPU memory contents. The application is also not expected to callcuCheckpointOperationComplete. Upon successful return, the target process will be in theCU_PROCESS_STATE_LOCKEDstate.- Parameters:
pid (int) – The process ID of the CUDA process.
args (intptr_t) – Optional restore operation arguments.
See also
cuCheckpointProcessRestore