def cudaMalloc ( count , ctype = None ) : ptr = ctypes . c_void_p ( ) status = _libcudart . cudaMalloc ( ctypes . byref ( ptr ) , count ) cudaCheckStatus ( status ) if ctype != None : ptr = ctypes . cast ( ptr , ctypes . POINTER ( ctype ) ) return ptr
python check cuda complibility
Allocate device memory .
def cudaMalloc(count, ctype=None):
    """
    Allocate device memory.

    Allocate memory on the device associated with the current active
    context.

    Parameters
    ----------
    count : int
        Number of bytes of memory to allocate
    ctype : _ctypes.SimpleType, optional
        ctypes type to cast returned pointer.

    Returns
    -------
    ptr : ctypes pointer
        Pointer to allocated device memory.

    """

    ptr = ctypes.c_void_p()
    status = _libcudart.cudaMalloc(ctypes.byref(ptr), count)
    cudaCheckStatus(status)
    if ctype != None:
        ptr = ctypes.cast(ptr, ctypes.POINTER(ctype))
    return ptr