@@ -86,6 +86,23 @@ cpdef destroy(intptr_t handle):
86
86
87
87
88
88
cpdef intptr_t create(uint32_t num_options, options) except - 1 :
89
+ """ nvJitLinkCreate creates an instance of nvJitLinkHandle with the given input options, and sets the output parameter ``handle``.
90
+
91
+ Args:
92
+ num_options (uint32_t): Number of options passed.
93
+ options (object): Array of size ``num_options`` of option strings. It can be:
94
+
95
+ - an :class:`int` as the pointer address to the nested sequence, or
96
+ - a Python sequence of :class:`int`\s, each of which is a pointer address
97
+ to a valid sequence of 'char', or
98
+ - a nested Python sequence of ``str``.
99
+
100
+
101
+ Returns:
102
+ intptr_t: Address of nvJitLink handle.
103
+
104
+ .. seealso:: `nvJitLinkCreate`
105
+ """
89
106
cdef nested_resource[ char ] _options_
90
107
get_nested_resource_ptr[char ](_options_, options, < char * > NULL )
91
108
cdef Handle handle
@@ -96,6 +113,17 @@ cpdef intptr_t create(uint32_t num_options, options) except -1:
96
113
97
114
98
115
cpdef add_data(intptr_t handle, int input_type, data, size_t size, name):
116
+ """ nvJitLinkAddData adds data image to the link.
117
+
118
+ Args:
119
+ handle (intptr_t): nvJitLink handle.
120
+ input_type (InputType): kind of input.
121
+ data (bytes): pointer to data image in memory.
122
+ size (size_t): size of the data.
123
+ name (str): name of input object.
124
+
125
+ .. seealso:: `nvJitLinkAddData`
126
+ """
99
127
cdef void * _data_ = get_buffer_pointer(data, size, readonly = True )
100
128
if not isinstance (name, str ):
101
129
raise TypeError (" name must be a Python str" )
@@ -107,6 +135,15 @@ cpdef add_data(intptr_t handle, int input_type, data, size_t size, name):
107
135
108
136
109
137
cpdef add_file(intptr_t handle, int input_type, file_name):
138
+ """ nvJitLinkAddFile reads data from file and links it in.
139
+
140
+ Args:
141
+ handle (intptr_t): nvJitLink handle.
142
+ input_type (InputType): kind of input.
143
+ file_name (str): name of file.
144
+
145
+ .. seealso:: `nvJitLinkAddFile`
146
+ """
110
147
if not isinstance (file_name, str ):
111
148
raise TypeError (" file_name must be a Python str" )
112
149
cdef bytes _temp_file_name_ = (< str > file_name).encode()
@@ -117,12 +154,29 @@ cpdef add_file(intptr_t handle, int input_type, file_name):
117
154
118
155
119
156
cpdef complete(intptr_t handle):
157
+ """ nvJitLinkComplete does the actual link.
158
+
159
+ Args:
160
+ handle (intptr_t): nvJitLink handle.
161
+
162
+ .. seealso:: `nvJitLinkComplete`
163
+ """
120
164
with nogil:
121
165
status = nvJitLinkComplete(< Handle> handle)
122
166
check_status(status)
123
167
124
168
125
169
cpdef size_t get_linked_cubin_size(intptr_t handle) except ? 0 :
170
+ """ nvJitLinkGetLinkedCubinSize gets the size of the linked cubin.
171
+
172
+ Args:
173
+ handle (intptr_t): nvJitLink handle.
174
+
175
+ Returns:
176
+ size_t: Size of the linked cubin.
177
+
178
+ .. seealso:: `nvJitLinkGetLinkedCubinSize`
179
+ """
126
180
cdef size_t size
127
181
with nogil:
128
182
status = nvJitLinkGetLinkedCubinSize(< Handle> handle, & size)
@@ -131,13 +185,31 @@ cpdef size_t get_linked_cubin_size(intptr_t handle) except? 0:
131
185
132
186
133
187
cpdef get_linked_cubin(intptr_t handle, cubin):
188
+ """ nvJitLinkGetLinkedCubin gets the linked cubin.
189
+
190
+ Args:
191
+ handle (intptr_t): nvJitLink handle.
192
+ cubin (bytes): The linked cubin.
193
+
194
+ .. seealso:: `nvJitLinkGetLinkedCubin`
195
+ """
134
196
cdef void * _cubin_ = get_buffer_pointer(cubin, - 1 , readonly = False )
135
197
with nogil:
136
198
status = nvJitLinkGetLinkedCubin(< Handle> handle, < void * > _cubin_)
137
199
check_status(status)
138
200
139
201
140
202
cpdef size_t get_linked_ptx_size(intptr_t handle) except ? 0 :
203
+ """ nvJitLinkGetLinkedPtxSize gets the size of the linked ptx.
204
+
205
+ Args:
206
+ handle (intptr_t): nvJitLink handle.
207
+
208
+ Returns:
209
+ size_t: Size of the linked PTX.
210
+
211
+ .. seealso:: `nvJitLinkGetLinkedPtxSize`
212
+ """
141
213
cdef size_t size
142
214
with nogil:
143
215
status = nvJitLinkGetLinkedPtxSize(< Handle> handle, & size)
@@ -146,13 +218,31 @@ cpdef size_t get_linked_ptx_size(intptr_t handle) except? 0:
146
218
147
219
148
220
cpdef get_linked_ptx(intptr_t handle, ptx):
221
+ """ nvJitLinkGetLinkedPtx gets the linked ptx.
222
+
223
+ Args:
224
+ handle (intptr_t): nvJitLink handle.
225
+ ptx (bytes): The linked PTX.
226
+
227
+ .. seealso:: `nvJitLinkGetLinkedPtx`
228
+ """
149
229
cdef void * _ptx_ = get_buffer_pointer(ptx, - 1 , readonly = False )
150
230
with nogil:
151
231
status = nvJitLinkGetLinkedPtx(< Handle> handle, < char * > _ptx_)
152
232
check_status(status)
153
233
154
234
155
235
cpdef size_t get_error_log_size(intptr_t handle) except ? 0 :
236
+ """ nvJitLinkGetErrorLogSize gets the size of the error log.
237
+
238
+ Args:
239
+ handle (intptr_t): nvJitLink handle.
240
+
241
+ Returns:
242
+ size_t: Size of the error log.
243
+
244
+ .. seealso:: `nvJitLinkGetErrorLogSize`
245
+ """
156
246
cdef size_t size
157
247
with nogil:
158
248
status = nvJitLinkGetErrorLogSize(< Handle> handle, & size)
@@ -161,13 +251,31 @@ cpdef size_t get_error_log_size(intptr_t handle) except? 0:
161
251
162
252
163
253
cpdef get_error_log(intptr_t handle, log):
254
+ """ nvJitLinkGetErrorLog puts any error messages in the log.
255
+
256
+ Args:
257
+ handle (intptr_t): nvJitLink handle.
258
+ log (bytes): The error log.
259
+
260
+ .. seealso:: `nvJitLinkGetErrorLog`
261
+ """
164
262
cdef void * _log_ = get_buffer_pointer(log, - 1 , readonly = False )
165
263
with nogil:
166
264
status = nvJitLinkGetErrorLog(< Handle> handle, < char * > _log_)
167
265
check_status(status)
168
266
169
267
170
268
cpdef size_t get_info_log_size(intptr_t handle) except ? 0 :
269
+ """ nvJitLinkGetInfoLogSize gets the size of the info log.
270
+
271
+ Args:
272
+ handle (intptr_t): nvJitLink handle.
273
+
274
+ Returns:
275
+ size_t: Size of the info log.
276
+
277
+ .. seealso:: `nvJitLinkGetInfoLogSize`
278
+ """
171
279
cdef size_t size
172
280
with nogil:
173
281
status = nvJitLinkGetInfoLogSize(< Handle> handle, & size)
@@ -176,13 +284,31 @@ cpdef size_t get_info_log_size(intptr_t handle) except? 0:
176
284
177
285
178
286
cpdef get_info_log(intptr_t handle, log):
287
+ """ nvJitLinkGetInfoLog puts any info messages in the log.
288
+
289
+ Args:
290
+ handle (intptr_t): nvJitLink handle.
291
+ log (bytes): The info log.
292
+
293
+ .. seealso:: `nvJitLinkGetInfoLog`
294
+ """
179
295
cdef void * _log_ = get_buffer_pointer(log, - 1 , readonly = False )
180
296
with nogil:
181
297
status = nvJitLinkGetInfoLog(< Handle> handle, < char * > _log_)
182
298
check_status(status)
183
299
184
300
185
301
cpdef tuple version():
302
+ """ nvJitLinkVersion returns the current version of nvJitLink.
303
+
304
+ Returns:
305
+ A 2-tuple containing:
306
+
307
+ - unsigned int: The major version.
308
+ - unsigned int: The minor version.
309
+
310
+ .. seealso:: `nvJitLinkVersion`
311
+ """
186
312
cdef unsigned int major
187
313
cdef unsigned int minor
188
314
with nogil:
0 commit comments