File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 66from numba .cuda .cudadrv .libs import get_cudalib
77from numba .cuda .cudadrv .linkable_code import LinkableCode
88
9+ from cuda .core .experimental import ObjectCode
10+
911import os
1012import subprocess
1113import tempfile
@@ -250,14 +252,15 @@ def get_cufunc(self):
250252 return cufunc
251253
252254 cubin = self .get_cubin (cc = device .compute_capability )
253- module = ctx .create_module_image (cubin )
255+
256+ # just a mock, https://github.com/NVIDIA/numba-cuda/pull/133 will
257+ # formalize the object code interface
258+ obj_code = ObjectCode .from_cubin (cubin )
259+ cufunc = obj_code .get_kernel (self ._entry_name )
254260
255261 # Init
256262 for init_fn in self ._init_functions :
257- init_fn (module )
258-
259- # Load
260- cufunc = module .get_function (self ._entry_name )
263+ init_fn (obj_code )
261264
262265 # Populate caches
263266 self ._cufunc_cache [device .id ] = cufunc
Original file line number Diff line number Diff line change 44from numba .cuda .cudadrv .linkable_code import CUSource
55from numba .cuda .testing import CUDATestCase
66
7- from cuda .bindings .driver import cuModuleGetGlobal , cuMemcpyHtoD
7+ from cuda .bindings .driver import (
8+ cuModuleGetGlobal ,
9+ cuMemcpyHtoD ,
10+ cuLibraryGetModule
11+ )
812
913
1014class TestModuleInitCallback (CUDATestCase ):
@@ -21,11 +25,13 @@ def setUp(self):
2125}
2226"""
2327
24- def set_fourty_two (mod ):
28+ def set_fourty_two (obj ):
2529 # Initialize 42 to global variable `num`
26- res , dptr , size = cuModuleGetGlobal (
27- mod .handle .value , "num" .encode ()
28- )
30+ culib = obj ._handle
31+ res , mod = cuLibraryGetModule (culib )
32+ self .assertEqual (res , 0 )
33+
34+ res , dptr , size = cuModuleGetGlobal (mod , "num" .encode ())
2935 self .assertEqual (res , 0 )
3036 self .assertEqual (size , 4 )
3137
You can’t perform that action at this time.
0 commit comments