Skip to content

Commit 365bf07

Browse files
cpcloudleofang
andauthored
feat: add support for CUcheckpointRestoreArgs (#975)
* feat: add support for CUcheckpointRestoreArgs * feat: generate APIs that use the newly allowed struct * chore: replace to avoid failure to parse * chore: fmt * Update release notes for CUDA bindings 13.X.Y --------- Co-authored-by: Leo Fang <leof@nvidia.com>
1 parent 3749929 commit 365bf07

File tree

9 files changed

+337
-0
lines changed

9 files changed

+337
-0
lines changed

cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,11 @@ cdef CUresult _cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) exce
22392239
cdef CUresult _cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil
22402240
{{endif}}
22412241

2242+
{{if 'cuCheckpointProcessRestore' in found_functions}}
2243+
2244+
cdef CUresult _cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil
2245+
{{endif}}
2246+
22422247
{{if 'cuCheckpointProcessUnlock' in found_functions}}
22432248

22442249
cdef CUresult _cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil

cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ cdef bint __cuPythonInit = False
463463
{{if 'cuCheckpointProcessGetState' in found_functions}}cdef void *__cuCheckpointProcessGetState = NULL{{endif}}
464464
{{if 'cuCheckpointProcessLock' in found_functions}}cdef void *__cuCheckpointProcessLock = NULL{{endif}}
465465
{{if 'cuCheckpointProcessCheckpoint' in found_functions}}cdef void *__cuCheckpointProcessCheckpoint = NULL{{endif}}
466+
{{if 'cuCheckpointProcessRestore' in found_functions}}cdef void *__cuCheckpointProcessRestore = NULL{{endif}}
466467
{{if 'cuCheckpointProcessUnlock' in found_functions}}cdef void *__cuCheckpointProcessUnlock = NULL{{endif}}
467468
{{if 'cuProfilerStart' in found_functions}}cdef void *__cuProfilerStart = NULL{{endif}}
468469
{{if 'cuProfilerStop' in found_functions}}cdef void *__cuProfilerStop = NULL{{endif}}
@@ -2667,6 +2668,10 @@ cdef int _cuPythonInit() except -1 nogil:
26672668
global __cuCheckpointProcessCheckpoint
26682669
_F_cuGetProcAddress_v2('cuCheckpointProcessCheckpoint', &__cuCheckpointProcessCheckpoint, 12080, CU_GET_PROC_ADDRESS_DEFAULT, NULL)
26692670
{{endif}}
2671+
{{if 'cuCheckpointProcessRestore' in found_functions}}
2672+
global __cuCheckpointProcessRestore
2673+
_F_cuGetProcAddress_v2('cuCheckpointProcessRestore', &__cuCheckpointProcessRestore, 12080, CU_GET_PROC_ADDRESS_DEFAULT, NULL)
2674+
{{endif}}
26702675
{{if 'cuCheckpointProcessUnlock' in found_functions}}
26712676
global __cuCheckpointProcessUnlock
26722677
_F_cuGetProcAddress_v2('cuCheckpointProcessUnlock', &__cuCheckpointProcessUnlock, 12080, CU_GET_PROC_ADDRESS_DEFAULT, NULL)
@@ -4895,6 +4900,10 @@ cdef int _cuPythonInit() except -1 nogil:
48954900
global __cuCheckpointProcessCheckpoint
48964901
__cuCheckpointProcessCheckpoint = windll.GetProcAddress(handle, 'cuCheckpointProcessCheckpoint')
48974902
{{endif}}
4903+
{{if 'cuCheckpointProcessRestore' in found_functions}}
4904+
global __cuCheckpointProcessRestore
4905+
__cuCheckpointProcessRestore = windll.GetProcAddress(handle, 'cuCheckpointProcessRestore')
4906+
{{endif}}
48984907
{{if 'cuCheckpointProcessUnlock' in found_functions}}
48994908
global __cuCheckpointProcessUnlock
49004909
__cuCheckpointProcessUnlock = windll.GetProcAddress(handle, 'cuCheckpointProcessUnlock')
@@ -7120,6 +7129,10 @@ cdef int _cuPythonInit() except -1 nogil:
71207129
global __cuCheckpointProcessCheckpoint
71217130
__cuCheckpointProcessCheckpoint = dlfcn.dlsym(handle, 'cuCheckpointProcessCheckpoint')
71227131
{{endif}}
7132+
{{if 'cuCheckpointProcessRestore' in found_functions}}
7133+
global __cuCheckpointProcessRestore
7134+
__cuCheckpointProcessRestore = dlfcn.dlsym(handle, 'cuCheckpointProcessRestore')
7135+
{{endif}}
71237136
{{if 'cuCheckpointProcessUnlock' in found_functions}}
71247137
global __cuCheckpointProcessUnlock
71257138
__cuCheckpointProcessUnlock = dlfcn.dlsym(handle, 'cuCheckpointProcessUnlock')
@@ -12583,6 +12596,18 @@ cdef CUresult _cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs
1258312596
return err
1258412597
{{endif}}
1258512598

12599+
{{if 'cuCheckpointProcessRestore' in found_functions}}
12600+
12601+
cdef CUresult _cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil:
12602+
global __cuCheckpointProcessRestore
12603+
cuPythonInit()
12604+
if __cuCheckpointProcessRestore == NULL:
12605+
with gil:
12606+
raise RuntimeError('Function "cuCheckpointProcessRestore" not found')
12607+
err = (<CUresult (*)(int, CUcheckpointRestoreArgs*) except ?CUDA_ERROR_NOT_FOUND nogil> __cuCheckpointProcessRestore)(pid, args)
12608+
return err
12609+
{{endif}}
12610+
1258612611
{{if 'cuCheckpointProcessUnlock' in found_functions}}
1258712612

1258812613
cdef CUresult _cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil:
@@ -15986,6 +16011,13 @@ cpdef dict _inspect_function_pointers():
1598616011
data["__cuCheckpointProcessCheckpoint"] = <intptr_t>0
1598716012
{{endif}}
1598816013

16014+
{{if 'cuCheckpointProcessRestore' in found_functions}}
16015+
global __cuCheckpointProcessRestore
16016+
data["__cuCheckpointProcessRestore"] = <intptr_t>__cuCheckpointProcessRestore
16017+
{{else}}
16018+
data["__cuCheckpointProcessRestore"] = <intptr_t>0
16019+
{{endif}}
16020+
1598916021
{{if 'cuCheckpointProcessUnlock' in found_functions}}
1599016022
global __cuCheckpointProcessUnlock
1599116023
data["__cuCheckpointProcessUnlock"] = <intptr_t>__cuCheckpointProcessUnlock

cuda_bindings/cuda/bindings/cydriver.pxd.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,6 +2357,14 @@ cdef extern from "cuda.h":
23572357

23582358
ctypedef CUcheckpointGpuPair_st CUcheckpointGpuPair
23592359

2360+
cdef struct CUcheckpointRestoreArgs_st:
2361+
CUcheckpointGpuPair* gpuPairs
2362+
unsigned int gpuPairsCount
2363+
char reserved[44]
2364+
cuuint64_t reserved1
2365+
2366+
ctypedef CUcheckpointRestoreArgs_st CUcheckpointRestoreArgs
2367+
23602368
cdef struct CUcheckpointUnlockArgs_st:
23612369
cuuint64_t reserved[8]
23622370

@@ -4907,6 +4915,11 @@ cdef CUresult cuCheckpointProcessLock(int pid, CUcheckpointLockArgs* args) excep
49074915
cdef CUresult cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil
49084916
{{endif}}
49094917

4918+
{{if 'cuCheckpointProcessRestore' in found_functions}}
4919+
4920+
cdef CUresult cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil
4921+
{{endif}}
4922+
49104923
{{if 'cuCheckpointProcessUnlock' in found_functions}}
49114924

49124925
cdef CUresult cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil

cuda_bindings/cuda/bindings/cydriver.pyx.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,6 +2686,12 @@ cdef CUresult cuCheckpointProcessCheckpoint(int pid, CUcheckpointCheckpointArgs*
26862686
return cydriver._cuCheckpointProcessCheckpoint(pid, args)
26872687
{{endif}}
26882688

2689+
{{if 'cuCheckpointProcessRestore' in found_functions}}
2690+
2691+
cdef CUresult cuCheckpointProcessRestore(int pid, CUcheckpointRestoreArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil:
2692+
return cydriver._cuCheckpointProcessRestore(pid, args)
2693+
{{endif}}
2694+
26892695
{{if 'cuCheckpointProcessUnlock' in found_functions}}
26902696

26912697
cdef CUresult cuCheckpointProcessUnlock(int pid, CUcheckpointUnlockArgs* args) except ?CUDA_ERROR_NOT_FOUND nogil:

cuda_bindings/cuda/bindings/driver.pxd.in

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5058,6 +5058,47 @@ cdef class CUcheckpointGpuPair_st:
50585058
cdef CUuuid _newUuid
50595059
{{endif}}
50605060
{{endif}}
5061+
{{if 'CUcheckpointRestoreArgs_st' in found_struct}}
5062+
5063+
cdef class CUcheckpointRestoreArgs_st:
5064+
"""
5065+
CUDA checkpoint optional restore arguments
5066+
5067+
Attributes
5068+
----------
5069+
{{if 'CUcheckpointRestoreArgs_st.gpuPairs' in found_struct}}
5070+
gpuPairs : CUcheckpointGpuPair
5071+
Pointer to array of gpu pairs that indicate how to remap GPUs
5072+
during restore
5073+
{{endif}}
5074+
{{if 'CUcheckpointRestoreArgs_st.gpuPairsCount' in found_struct}}
5075+
gpuPairsCount : unsigned int
5076+
Number of gpu pairs to remap
5077+
{{endif}}
5078+
{{if 'CUcheckpointRestoreArgs_st.reserved' in found_struct}}
5079+
reserved : bytes
5080+
Reserved for future use, must be zeroed
5081+
{{endif}}
5082+
{{if 'CUcheckpointRestoreArgs_st.reserved1' in found_struct}}
5083+
reserved1 : cuuint64_t
5084+
Reserved for future use, must be zeroed
5085+
{{endif}}
5086+
5087+
Methods
5088+
-------
5089+
getPtr()
5090+
Get memory address of class instance
5091+
"""
5092+
cdef cydriver.CUcheckpointRestoreArgs_st _pvt_val
5093+
cdef cydriver.CUcheckpointRestoreArgs_st* _pvt_ptr
5094+
{{if 'CUcheckpointRestoreArgs_st.gpuPairs' in found_struct}}
5095+
cdef size_t _gpuPairs_length
5096+
cdef cydriver.CUcheckpointGpuPair* _gpuPairs
5097+
{{endif}}
5098+
{{if 'CUcheckpointRestoreArgs_st.reserved1' in found_struct}}
5099+
cdef cuuint64_t _reserved1
5100+
{{endif}}
5101+
{{endif}}
50615102
{{if 'CUcheckpointUnlockArgs_st' in found_struct}}
50625103

50635104
cdef class CUcheckpointUnlockArgs_st:
@@ -10563,6 +10604,39 @@ cdef class CUcheckpointGpuPair(CUcheckpointGpuPair_st):
1056310604
"""
1056410605
pass
1056510606
{{endif}}
10607+
{{if 'CUcheckpointRestoreArgs' in found_types}}
10608+
10609+
cdef class CUcheckpointRestoreArgs(CUcheckpointRestoreArgs_st):
10610+
"""
10611+
CUDA checkpoint optional restore arguments
10612+
10613+
Attributes
10614+
----------
10615+
{{if 'CUcheckpointRestoreArgs_st.gpuPairs' in found_struct}}
10616+
gpuPairs : CUcheckpointGpuPair
10617+
Pointer to array of gpu pairs that indicate how to remap GPUs
10618+
during restore
10619+
{{endif}}
10620+
{{if 'CUcheckpointRestoreArgs_st.gpuPairsCount' in found_struct}}
10621+
gpuPairsCount : unsigned int
10622+
Number of gpu pairs to remap
10623+
{{endif}}
10624+
{{if 'CUcheckpointRestoreArgs_st.reserved' in found_struct}}
10625+
reserved : bytes
10626+
Reserved for future use, must be zeroed
10627+
{{endif}}
10628+
{{if 'CUcheckpointRestoreArgs_st.reserved1' in found_struct}}
10629+
reserved1 : cuuint64_t
10630+
Reserved for future use, must be zeroed
10631+
{{endif}}
10632+
10633+
Methods
10634+
-------
10635+
getPtr()
10636+
Get memory address of class instance
10637+
"""
10638+
pass
10639+
{{endif}}
1056610640
{{if 'CUcheckpointUnlockArgs' in found_types}}
1056710641

1056810642
cdef class CUcheckpointUnlockArgs(CUcheckpointUnlockArgs_st):

0 commit comments

Comments
 (0)