Skip to content

Commit

Permalink
Allow a managed numpy array to be passed directly to a kernel as if it
Browse files Browse the repository at this point in the history
was a gpuarray.
  • Loading branch information
seibert committed Feb 17, 2014
1 parent 55e4acb commit 817928c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pycuda/driver.py
Expand Up @@ -117,8 +117,12 @@ def _build_arg_buf(args):
arg_data.append(int(arg.get_device_alloc()))
format += "P"
elif isinstance(arg, np.ndarray):
arg_data.append(arg)
format += "%ds" % arg.nbytes
if isinstance(arg.base, (ManagedAllocation,)):
arg_data.append(int(arg.base))
format += "P"
else:
arg_data.append(arg)
format += "%ds" % arg.nbytes
else:
try:
gpudata = np.intp(arg.gpudata)
Expand Down

0 comments on commit 817928c

Please sign in to comment.