1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
Description: Don't try to read numpy's updateifcopy
(it no longer exists)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/1026345
Forwarded: no
--- a/pygpu/gpuarray.pyx
+++ b/pygpu/gpuarray.pyx
@@ -1224,6 +1224,8 @@ cdef class flags(object):
return self.aligned
elif c == 'U':
return self.updateifcopy
+ elif c == 'X':
+ return self.writebackifcopy
elif n == 2:
if strncmp(key, "CA", n) == 0:
return self.carray
@@ -1262,6 +1264,9 @@ cdef class flags(object):
return self.c_contiguous
if strncmp(key, "F_CONTIGUOUS", n) == 0:
return self.f_contiguous
+ elif n == 15:
+ if strncmp(key, "WRITEBACKIFCOPY", n) == 0:
+ return self.writebackifcopy
raise KeyError, "Unknown flag"
@@ -1269,7 +1274,7 @@ cdef class flags(object):
return '\n'.join(" %s : %s" % (name.upper(), getattr(self, name))
for name in ["c_contiguous", "f_contiguous",
"owndata", "writeable", "aligned",
- "updateifcopy"])
+ "updateifcopy", "writebackifcopy"])
def __richcmp__(self, other, int op):
cdef flags a
@@ -1305,6 +1310,11 @@ cdef class flags(object):
def __get__(self):
return False
+ property writebackifcopy:
+ # Not supported.
+ def __get__(self):
+ return False
+
property owndata:
# There is no equivalent for GpuArrays and it is always "True".
def __get__(self):
@@ -2210,7 +2220,7 @@ cdef class GpuArray:
This is mostly numpy-compatible with some exceptions:
* Flags are always constant (numpy allows modification of certain flags in certain cicumstances).
* OWNDATA is always True, since the data is refcounted in libgpuarray.
- * UPDATEIFCOPY is not supported, therefore always False.
+ * UPDATEIFCOPY/WRITEBACKIFCOPY are not supported, therefore always False.
"""
def __get__(self):
return flags(self.ga.flags)
--- a/pygpu/tests/support.py
+++ b/pygpu/tests/support.py
@@ -82,7 +82,7 @@ def check_flags(x, y):
assert x.flags["WRITEABLE"] == y.flags["WRITEABLE"], (x.flags, y.flags)
# Don't check for OWNDATA since it is always true for a GpuArray
assert x.flags["ALIGNED"] == y.flags["ALIGNED"], (x.flags, y.flags)
- assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"], (x.flags,
+ assert x.flags["WRITEBACKIFCOPY"] == y.flags["WRITEBACKIFCOPY"], (x.flags,
y.flags)
--- a/pygpu/tests/test_gpu_ndarray.py
+++ b/pygpu/tests/test_gpu_ndarray.py
@@ -685,7 +685,7 @@ def _cmp(x, y):
if x.flags["WRITEABLE"] != y.flags["WRITEABLE"]:
assert x.ndim == 0
assert x.flags["ALIGNED"] == y.flags["ALIGNED"], (x.flags, y.flags)
- assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"], (x.flags,
+ assert x.flags["WRITEBACKIFCOPY"] == y.flags["WRITEBACKIFCOPY"], (x.flags,
y.flags)
x = numpy.asarray(x)
assert x.shape == y.shape
@@ -710,7 +710,7 @@ def _cmpNs(x, y):
assert x.flags["WRITEABLE"] == y.flags["WRITEABLE"]
assert x.flags["ALIGNED"] == y.flags["ALIGNED"]
# we don't check owndata since it is always true for GpuArrays
- assert x.flags["UPDATEIFCOPY"] == y.flags["UPDATEIFCOPY"]
+ assert x.flags["WRITEBACKIFCOPY"] == y.flags["WRITEBACKIFCOPY"]
x_ = numpy.asarray(x)
assert x_.shape == y.shape
assert x_.dtype == y.dtype
@@ -756,13 +756,13 @@ def do_take1(shp, idx, offseted):
def test_flags():
- for fl in ['C', 'F', 'W', 'B', 'O', 'A', 'U', 'CA', 'FA', 'FNC', 'FORC',
+ for fl in ['C', 'F', 'W', 'B', 'O', 'A', 'X', 'CA', 'FA', 'FNC', 'FORC',
'CARRAY', 'FARRAY', 'FORTRAN', 'BEHAVED', 'OWNDATA', 'ALIGNED',
- 'WRITEABLE', 'CONTIGUOUS', 'UPDATEIFCOPY', 'C_CONTIGUOUS',
+ 'WRITEABLE', 'CONTIGUOUS', 'WRITEBACKIFCOPY', 'C_CONTIGUOUS',
'F_CONTIGUOUS']:
flag_dict(fl)
for p in ['c_contiguous', 'f_contiguous', 'contiguous', 'fortran',
- 'updateifcopy', 'owndata', 'aligned', 'writeable', 'behaved',
+ 'writebackifcopy', 'owndata', 'aligned', 'writeable', 'behaved',
'carray', 'forc', 'fnc', 'farray']:
flag_prop(p)
|