Python pycuda.driver.mem_alloc()在哪里?在pycuda/driver.py中,我只能找到mem_alloc_like()
我是python和PYCUDA的新手 在许多PYCUDA示例中,我可以找到如下代码:Python pycuda.driver.mem_alloc()在哪里?在pycuda/driver.py中,我只能找到mem_alloc_like(),python,cuda,pycuda,Python,Cuda,Pycuda,我是python和PYCUDA的新手 在许多PYCUDA示例中,我可以找到如下代码: import pycuda.driver as cuda cuda.mem_alloc(a.nbytes) 但是当我查看pycuda/driver.py时,我找不到mem_alloc是在哪里定义的 我只能找到mem_alloc_like,它调用mem_alloc(): 这告诉我mem_alloc必须在libraries driver.py imports中的某个位置 但是,以下是我在driver.py中找
import pycuda.driver as cuda
cuda.mem_alloc(a.nbytes)
但是当我查看pycuda/driver.py时,我找不到mem_alloc是在哪里定义的
我只能找到mem_alloc_like,它调用mem_alloc():
这告诉我mem_alloc必须在libraries driver.py imports中的某个位置
但是,以下是我在driver.py中找到的导入,而six、numpy或sys都没有名为“mem_alloc()的函数”
pyCUDA是CUDA驱动程序API的包装器。这就是pyCUDA公开这些api的方式
\u驱动程序。因此
的共享库。\u驱动程序导入*
它在
pycuda/src/cpp/cuda中定义。hpp
pycuda是cuda驱动程序API的包装器。这就是pyCUDA公开这些api的方式
\u驱动程序。因此
的共享库。\u驱动程序导入*
pycuda/src/cpp/cuda.hpp
def mem_alloc_like(ary):
return mem_alloc(ary.nbytes)
from __future__ import absolute_import
from __future__ import print_function
import six
try:
from pycuda._driver import * # noqa
except ImportError as e:
if "_v2" in str(e):
from warnings import warn
warn("Failed to import the CUDA driver interface, with an error "
"message indicating that the version of your CUDA header "
"does not match the version of your CUDA driver.")
raise
import numpy as np
import sys