How to dump cubin?

I tried to dump the generated cubin file but failed, is there any easier way than hacking the source code (I noticed that there are related functions under numba/cuda/codegen.py)?

Thanks ahead!

Hi @shiyuw3

I think this might do what you want, but it does reach into internal APIs that should not be considered stable:

from numba import cuda
import numpy as np

@cuda.jit
def foo(x):
    x[0] = 1

z = np.zeros(1)
print(z)
foo[1, 1](z)
print(z)

cubin = foo.overloads[foo.sigs[0]]._codelibrary.get_cubin()
print(cubin)

Hope this helps?