コード例 #1
0
ファイル: test_linker.py プロジェクト: smtlify/numba
 def test_linker_basic(self):
     '''Simply go through the constructor and destructor
     '''
     linker = Linker()
     del linker
コード例 #2
0
                                                          cres.signature.args,
                                                          debug=False)
    llvm_module = lib._final_module

    cc = (5, 2)
    arch = nvvm.get_arch_option(*cc)
    llvmir = str(llvm_module)
    ptx = nvvm.llvm_to_ptx(llvmir, opt=3, arch=arch)

print(ptx.decode('utf-8'))

# PTX to module

from numba.cuda.cudadrv.driver import Linker  # noqa

linker = Linker()
linker.add_ptx(ptx)
cubin, size = linker.complete()

compile_info = linker.info_log

print(size)
print(compile_info)

import ctypes  # noqa

cubinarr = np.ctypeslib.as_array(ctypes.cast(cubin,
                                             ctypes.POINTER(ctypes.c_char)),
                                 shape=(size, ))

with open('axpy.cubin', 'wb') as f: