Skip to content

Commit

Permalink
Make check for ManagedAllocation fail safely on CUDA < 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Mar 9, 2014
1 parent d62bbbe commit 56414bf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pycuda/driver.py
Expand Up @@ -11,6 +11,16 @@
import numpy as np


try:
ManagedAllocationOrStub = ManagedAllocation
except NameError:
# Provide ManagedAllocationOrStub if not on CUDA 6.
# This avoids having to do a version check in a high-traffic code path below.

class ManagedAllocationOrStub(object):
pass


CUDA_DEBUGGING = False


Expand Down Expand Up @@ -117,7 +127,7 @@ def _build_arg_buf(args):
arg_data.append(int(arg.get_device_alloc()))
format += "P"
elif isinstance(arg, np.ndarray):
if isinstance(arg.base, (ManagedAllocation,)):
if isinstance(arg.base, ManagedAllocationOrStub):
arg_data.append(int(arg.base))
format += "P"
else:
Expand Down

0 comments on commit 56414bf

Please sign in to comment.