Skip to content

Commit bb84cfe

Browse files
committed
Fix code having no version checks on Linux
1 parent b36d799 commit bb84cfe

File tree

3 files changed

+73
-73
lines changed

3 files changed

+73
-73
lines changed

cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ cdef void* __cuFileSetParameterPosixPoolSlabArray = NULL
8585
cdef void* __cuFileGetParameterPosixPoolSlabArray = NULL
8686

8787

88-
cdef void* load_library(const int driver_ver) except* with gil:
88+
cdef void* load_library() except* with gil:
8989
cdef uintptr_t handle = load_nvidia_dynamic_lib("cufile")._handle_uint
9090
return <void*>handle
9191

@@ -103,301 +103,301 @@ cdef int _check_or_init_cufile() except -1 nogil:
103103
__cuFileHandleRegister = dlsym(RTLD_DEFAULT, 'cuFileHandleRegister')
104104
if __cuFileHandleRegister == NULL:
105105
if handle == NULL:
106-
handle = load_library(driver_ver)
106+
handle = load_library()
107107
__cuFileHandleRegister = dlsym(handle, 'cuFileHandleRegister')
108108

109109
global __cuFileHandleDeregister
110110
__cuFileHandleDeregister = dlsym(RTLD_DEFAULT, 'cuFileHandleDeregister')
111111
if __cuFileHandleDeregister == NULL:
112112
if handle == NULL:
113-
handle = load_library(driver_ver)
113+
handle = load_library()
114114
__cuFileHandleDeregister = dlsym(handle, 'cuFileHandleDeregister')
115115

116116
global __cuFileBufRegister
117117
__cuFileBufRegister = dlsym(RTLD_DEFAULT, 'cuFileBufRegister')
118118
if __cuFileBufRegister == NULL:
119119
if handle == NULL:
120-
handle = load_library(driver_ver)
120+
handle = load_library()
121121
__cuFileBufRegister = dlsym(handle, 'cuFileBufRegister')
122122

123123
global __cuFileBufDeregister
124124
__cuFileBufDeregister = dlsym(RTLD_DEFAULT, 'cuFileBufDeregister')
125125
if __cuFileBufDeregister == NULL:
126126
if handle == NULL:
127-
handle = load_library(driver_ver)
127+
handle = load_library()
128128
__cuFileBufDeregister = dlsym(handle, 'cuFileBufDeregister')
129129

130130
global __cuFileRead
131131
__cuFileRead = dlsym(RTLD_DEFAULT, 'cuFileRead')
132132
if __cuFileRead == NULL:
133133
if handle == NULL:
134-
handle = load_library(driver_ver)
134+
handle = load_library()
135135
__cuFileRead = dlsym(handle, 'cuFileRead')
136136

137137
global __cuFileWrite
138138
__cuFileWrite = dlsym(RTLD_DEFAULT, 'cuFileWrite')
139139
if __cuFileWrite == NULL:
140140
if handle == NULL:
141-
handle = load_library(driver_ver)
141+
handle = load_library()
142142
__cuFileWrite = dlsym(handle, 'cuFileWrite')
143143

144144
global __cuFileDriverOpen
145145
__cuFileDriverOpen = dlsym(RTLD_DEFAULT, 'cuFileDriverOpen')
146146
if __cuFileDriverOpen == NULL:
147147
if handle == NULL:
148-
handle = load_library(driver_ver)
148+
handle = load_library()
149149
__cuFileDriverOpen = dlsym(handle, 'cuFileDriverOpen')
150150

151151
global __cuFileDriverClose_v2
152152
__cuFileDriverClose_v2 = dlsym(RTLD_DEFAULT, 'cuFileDriverClose_v2')
153153
if __cuFileDriverClose_v2 == NULL:
154154
if handle == NULL:
155-
handle = load_library(driver_ver)
155+
handle = load_library()
156156
__cuFileDriverClose_v2 = dlsym(handle, 'cuFileDriverClose_v2')
157157

158158
global __cuFileUseCount
159159
__cuFileUseCount = dlsym(RTLD_DEFAULT, 'cuFileUseCount')
160160
if __cuFileUseCount == NULL:
161161
if handle == NULL:
162-
handle = load_library(driver_ver)
162+
handle = load_library()
163163
__cuFileUseCount = dlsym(handle, 'cuFileUseCount')
164164

165165
global __cuFileDriverGetProperties
166166
__cuFileDriverGetProperties = dlsym(RTLD_DEFAULT, 'cuFileDriverGetProperties')
167167
if __cuFileDriverGetProperties == NULL:
168168
if handle == NULL:
169-
handle = load_library(driver_ver)
169+
handle = load_library()
170170
__cuFileDriverGetProperties = dlsym(handle, 'cuFileDriverGetProperties')
171171

172172
global __cuFileDriverSetPollMode
173173
__cuFileDriverSetPollMode = dlsym(RTLD_DEFAULT, 'cuFileDriverSetPollMode')
174174
if __cuFileDriverSetPollMode == NULL:
175175
if handle == NULL:
176-
handle = load_library(driver_ver)
176+
handle = load_library()
177177
__cuFileDriverSetPollMode = dlsym(handle, 'cuFileDriverSetPollMode')
178178

179179
global __cuFileDriverSetMaxDirectIOSize
180180
__cuFileDriverSetMaxDirectIOSize = dlsym(RTLD_DEFAULT, 'cuFileDriverSetMaxDirectIOSize')
181181
if __cuFileDriverSetMaxDirectIOSize == NULL:
182182
if handle == NULL:
183-
handle = load_library(driver_ver)
183+
handle = load_library()
184184
__cuFileDriverSetMaxDirectIOSize = dlsym(handle, 'cuFileDriverSetMaxDirectIOSize')
185185

186186
global __cuFileDriverSetMaxCacheSize
187187
__cuFileDriverSetMaxCacheSize = dlsym(RTLD_DEFAULT, 'cuFileDriverSetMaxCacheSize')
188188
if __cuFileDriverSetMaxCacheSize == NULL:
189189
if handle == NULL:
190-
handle = load_library(driver_ver)
190+
handle = load_library()
191191
__cuFileDriverSetMaxCacheSize = dlsym(handle, 'cuFileDriverSetMaxCacheSize')
192192

193193
global __cuFileDriverSetMaxPinnedMemSize
194194
__cuFileDriverSetMaxPinnedMemSize = dlsym(RTLD_DEFAULT, 'cuFileDriverSetMaxPinnedMemSize')
195195
if __cuFileDriverSetMaxPinnedMemSize == NULL:
196196
if handle == NULL:
197-
handle = load_library(driver_ver)
197+
handle = load_library()
198198
__cuFileDriverSetMaxPinnedMemSize = dlsym(handle, 'cuFileDriverSetMaxPinnedMemSize')
199199

200200
global __cuFileBatchIOSetUp
201201
__cuFileBatchIOSetUp = dlsym(RTLD_DEFAULT, 'cuFileBatchIOSetUp')
202202
if __cuFileBatchIOSetUp == NULL:
203203
if handle == NULL:
204-
handle = load_library(driver_ver)
204+
handle = load_library()
205205
__cuFileBatchIOSetUp = dlsym(handle, 'cuFileBatchIOSetUp')
206206

207207
global __cuFileBatchIOSubmit
208208
__cuFileBatchIOSubmit = dlsym(RTLD_DEFAULT, 'cuFileBatchIOSubmit')
209209
if __cuFileBatchIOSubmit == NULL:
210210
if handle == NULL:
211-
handle = load_library(driver_ver)
211+
handle = load_library()
212212
__cuFileBatchIOSubmit = dlsym(handle, 'cuFileBatchIOSubmit')
213213

214214
global __cuFileBatchIOGetStatus
215215
__cuFileBatchIOGetStatus = dlsym(RTLD_DEFAULT, 'cuFileBatchIOGetStatus')
216216
if __cuFileBatchIOGetStatus == NULL:
217217
if handle == NULL:
218-
handle = load_library(driver_ver)
218+
handle = load_library()
219219
__cuFileBatchIOGetStatus = dlsym(handle, 'cuFileBatchIOGetStatus')
220220

221221
global __cuFileBatchIOCancel
222222
__cuFileBatchIOCancel = dlsym(RTLD_DEFAULT, 'cuFileBatchIOCancel')
223223
if __cuFileBatchIOCancel == NULL:
224224
if handle == NULL:
225-
handle = load_library(driver_ver)
225+
handle = load_library()
226226
__cuFileBatchIOCancel = dlsym(handle, 'cuFileBatchIOCancel')
227227

228228
global __cuFileBatchIODestroy
229229
__cuFileBatchIODestroy = dlsym(RTLD_DEFAULT, 'cuFileBatchIODestroy')
230230
if __cuFileBatchIODestroy == NULL:
231231
if handle == NULL:
232-
handle = load_library(driver_ver)
232+
handle = load_library()
233233
__cuFileBatchIODestroy = dlsym(handle, 'cuFileBatchIODestroy')
234234

235235
global __cuFileReadAsync
236236
__cuFileReadAsync = dlsym(RTLD_DEFAULT, 'cuFileReadAsync')
237237
if __cuFileReadAsync == NULL:
238238
if handle == NULL:
239-
handle = load_library(driver_ver)
239+
handle = load_library()
240240
__cuFileReadAsync = dlsym(handle, 'cuFileReadAsync')
241241

242242
global __cuFileWriteAsync
243243
__cuFileWriteAsync = dlsym(RTLD_DEFAULT, 'cuFileWriteAsync')
244244
if __cuFileWriteAsync == NULL:
245245
if handle == NULL:
246-
handle = load_library(driver_ver)
246+
handle = load_library()
247247
__cuFileWriteAsync = dlsym(handle, 'cuFileWriteAsync')
248248

249249
global __cuFileStreamRegister
250250
__cuFileStreamRegister = dlsym(RTLD_DEFAULT, 'cuFileStreamRegister')
251251
if __cuFileStreamRegister == NULL:
252252
if handle == NULL:
253-
handle = load_library(driver_ver)
253+
handle = load_library()
254254
__cuFileStreamRegister = dlsym(handle, 'cuFileStreamRegister')
255255

256256
global __cuFileStreamDeregister
257257
__cuFileStreamDeregister = dlsym(RTLD_DEFAULT, 'cuFileStreamDeregister')
258258
if __cuFileStreamDeregister == NULL:
259259
if handle == NULL:
260-
handle = load_library(driver_ver)
260+
handle = load_library()
261261
__cuFileStreamDeregister = dlsym(handle, 'cuFileStreamDeregister')
262262

263263
global __cuFileGetVersion
264264
__cuFileGetVersion = dlsym(RTLD_DEFAULT, 'cuFileGetVersion')
265265
if __cuFileGetVersion == NULL:
266266
if handle == NULL:
267-
handle = load_library(driver_ver)
267+
handle = load_library()
268268
__cuFileGetVersion = dlsym(handle, 'cuFileGetVersion')
269269

270270
global __cuFileGetParameterSizeT
271271
__cuFileGetParameterSizeT = dlsym(RTLD_DEFAULT, 'cuFileGetParameterSizeT')
272272
if __cuFileGetParameterSizeT == NULL:
273273
if handle == NULL:
274-
handle = load_library(driver_ver)
274+
handle = load_library()
275275
__cuFileGetParameterSizeT = dlsym(handle, 'cuFileGetParameterSizeT')
276276

277277
global __cuFileGetParameterBool
278278
__cuFileGetParameterBool = dlsym(RTLD_DEFAULT, 'cuFileGetParameterBool')
279279
if __cuFileGetParameterBool == NULL:
280280
if handle == NULL:
281-
handle = load_library(driver_ver)
281+
handle = load_library()
282282
__cuFileGetParameterBool = dlsym(handle, 'cuFileGetParameterBool')
283283

284284
global __cuFileGetParameterString
285285
__cuFileGetParameterString = dlsym(RTLD_DEFAULT, 'cuFileGetParameterString')
286286
if __cuFileGetParameterString == NULL:
287287
if handle == NULL:
288-
handle = load_library(driver_ver)
288+
handle = load_library()
289289
__cuFileGetParameterString = dlsym(handle, 'cuFileGetParameterString')
290290

291291
global __cuFileSetParameterSizeT
292292
__cuFileSetParameterSizeT = dlsym(RTLD_DEFAULT, 'cuFileSetParameterSizeT')
293293
if __cuFileSetParameterSizeT == NULL:
294294
if handle == NULL:
295-
handle = load_library(driver_ver)
295+
handle = load_library()
296296
__cuFileSetParameterSizeT = dlsym(handle, 'cuFileSetParameterSizeT')
297297

298298
global __cuFileSetParameterBool
299299
__cuFileSetParameterBool = dlsym(RTLD_DEFAULT, 'cuFileSetParameterBool')
300300
if __cuFileSetParameterBool == NULL:
301301
if handle == NULL:
302-
handle = load_library(driver_ver)
302+
handle = load_library()
303303
__cuFileSetParameterBool = dlsym(handle, 'cuFileSetParameterBool')
304304

305305
global __cuFileSetParameterString
306306
__cuFileSetParameterString = dlsym(RTLD_DEFAULT, 'cuFileSetParameterString')
307307
if __cuFileSetParameterString == NULL:
308308
if handle == NULL:
309-
handle = load_library(driver_ver)
309+
handle = load_library()
310310
__cuFileSetParameterString = dlsym(handle, 'cuFileSetParameterString')
311311

312312
global __cuFileDriverClose
313313
__cuFileDriverClose = dlsym(RTLD_DEFAULT, 'cuFileDriverClose')
314314
if __cuFileDriverClose == NULL:
315315
if handle == NULL:
316-
handle = load_library(driver_ver)
316+
handle = load_library()
317317
__cuFileDriverClose = dlsym(handle, 'cuFileDriverClose')
318318

319319
global __cuFileGetParameterMinMaxValue
320320
__cuFileGetParameterMinMaxValue = dlsym(RTLD_DEFAULT, 'cuFileGetParameterMinMaxValue')
321321
if __cuFileGetParameterMinMaxValue == NULL:
322322
if handle == NULL:
323-
handle = load_library(driver_ver)
323+
handle = load_library()
324324
__cuFileGetParameterMinMaxValue = dlsym(handle, 'cuFileGetParameterMinMaxValue')
325325

326326
global __cuFileSetStatsLevel
327327
__cuFileSetStatsLevel = dlsym(RTLD_DEFAULT, 'cuFileSetStatsLevel')
328328
if __cuFileSetStatsLevel == NULL:
329329
if handle == NULL:
330-
handle = load_library(driver_ver)
330+
handle = load_library()
331331
__cuFileSetStatsLevel = dlsym(handle, 'cuFileSetStatsLevel')
332332

333333
global __cuFileGetStatsLevel
334334
__cuFileGetStatsLevel = dlsym(RTLD_DEFAULT, 'cuFileGetStatsLevel')
335335
if __cuFileGetStatsLevel == NULL:
336336
if handle == NULL:
337-
handle = load_library(driver_ver)
337+
handle = load_library()
338338
__cuFileGetStatsLevel = dlsym(handle, 'cuFileGetStatsLevel')
339339

340340
global __cuFileStatsStart
341341
__cuFileStatsStart = dlsym(RTLD_DEFAULT, 'cuFileStatsStart')
342342
if __cuFileStatsStart == NULL:
343343
if handle == NULL:
344-
handle = load_library(driver_ver)
344+
handle = load_library()
345345
__cuFileStatsStart = dlsym(handle, 'cuFileStatsStart')
346346

347347
global __cuFileStatsStop
348348
__cuFileStatsStop = dlsym(RTLD_DEFAULT, 'cuFileStatsStop')
349349
if __cuFileStatsStop == NULL:
350350
if handle == NULL:
351-
handle = load_library(driver_ver)
351+
handle = load_library()
352352
__cuFileStatsStop = dlsym(handle, 'cuFileStatsStop')
353353

354354
global __cuFileStatsReset
355355
__cuFileStatsReset = dlsym(RTLD_DEFAULT, 'cuFileStatsReset')
356356
if __cuFileStatsReset == NULL:
357357
if handle == NULL:
358-
handle = load_library(driver_ver)
358+
handle = load_library()
359359
__cuFileStatsReset = dlsym(handle, 'cuFileStatsReset')
360360

361361
global __cuFileGetStatsL1
362362
__cuFileGetStatsL1 = dlsym(RTLD_DEFAULT, 'cuFileGetStatsL1')
363363
if __cuFileGetStatsL1 == NULL:
364364
if handle == NULL:
365-
handle = load_library(driver_ver)
365+
handle = load_library()
366366
__cuFileGetStatsL1 = dlsym(handle, 'cuFileGetStatsL1')
367367

368368
global __cuFileGetStatsL2
369369
__cuFileGetStatsL2 = dlsym(RTLD_DEFAULT, 'cuFileGetStatsL2')
370370
if __cuFileGetStatsL2 == NULL:
371371
if handle == NULL:
372-
handle = load_library(driver_ver)
372+
handle = load_library()
373373
__cuFileGetStatsL2 = dlsym(handle, 'cuFileGetStatsL2')
374374

375375
global __cuFileGetStatsL3
376376
__cuFileGetStatsL3 = dlsym(RTLD_DEFAULT, 'cuFileGetStatsL3')
377377
if __cuFileGetStatsL3 == NULL:
378378
if handle == NULL:
379-
handle = load_library(driver_ver)
379+
handle = load_library()
380380
__cuFileGetStatsL3 = dlsym(handle, 'cuFileGetStatsL3')
381381

382382
global __cuFileGetBARSizeInKB
383383
__cuFileGetBARSizeInKB = dlsym(RTLD_DEFAULT, 'cuFileGetBARSizeInKB')
384384
if __cuFileGetBARSizeInKB == NULL:
385385
if handle == NULL:
386-
handle = load_library(driver_ver)
386+
handle = load_library()
387387
__cuFileGetBARSizeInKB = dlsym(handle, 'cuFileGetBARSizeInKB')
388388

389389
global __cuFileSetParameterPosixPoolSlabArray
390390
__cuFileSetParameterPosixPoolSlabArray = dlsym(RTLD_DEFAULT, 'cuFileSetParameterPosixPoolSlabArray')
391391
if __cuFileSetParameterPosixPoolSlabArray == NULL:
392392
if handle == NULL:
393-
handle = load_library(driver_ver)
393+
handle = load_library()
394394
__cuFileSetParameterPosixPoolSlabArray = dlsym(handle, 'cuFileSetParameterPosixPoolSlabArray')
395395

396396
global __cuFileGetParameterPosixPoolSlabArray
397397
__cuFileGetParameterPosixPoolSlabArray = dlsym(RTLD_DEFAULT, 'cuFileGetParameterPosixPoolSlabArray')
398398
if __cuFileGetParameterPosixPoolSlabArray == NULL:
399399
if handle == NULL:
400-
handle = load_library(driver_ver)
400+
handle = load_library()
401401
__cuFileGetParameterPosixPoolSlabArray = dlsym(handle, 'cuFileGetParameterPosixPoolSlabArray')
402402

403403
__py_cufile_init = True

0 commit comments

Comments
 (0)