can't access certain libcudart functions with Python ctypes

It seems that certain CUDA functions that are ostensibly in the libcudart library are not accessible via Python ctypes. For example, cudaMalloc appears to be accessible:

[codebox]In [1]: import ctypes

In [2]: libcudart = ctypes.cdll.LoadLibrary(‘libcudart.so’)

In [3]: libcudart.cudaMalloc

Out[3]: <_FuncPtr object at 0xae46d0>[/codebox]

However, other functions like cuCtxAttach are not:

[codebox]In [4]: libcudart.cuCtxAttach


AttributeError Traceback (most recent call last)

(snip)

AttributeError: /usr/lib64/libcudart.so.3: undefined symbol: cuCtxAttach[/codebox]

Does anyone have any idea why this is so?

I’m using CUDA 3.0 and Python 2.6.4 on 64-bit Linux.

cuCtxAttach is a driver API function, so it will be in cuda.so, not cudart.so (which is only runtime API functions).