Skip to content

Commit 8ac2448

Browse files
committed
Remove the buffer functionality for GpuCommCliqueId since it crashes hard in some case and isn't necessary.
1 parent 61b7cac commit 8ac2448

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

pygpu/collectives.pyx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,6 @@ cdef class GpuCommCliqueId:
3838
if comm_id is not None:
3939
self.comm_id = comm_id
4040

41-
def __getbuffer__(self, Py_buffer* buffer, int flags):
42-
if buffer == NULL:
43-
raise BufferError, "NULL buffer view in getbuffer"
44-
45-
buffer.buf = <char*>self.c_comm_id.internal
46-
buffer.obj = self
47-
buffer.len = GA_COMM_ID_BYTES * sizeof(char)
48-
buffer.readonly = 0
49-
buffer.itemsize = sizeof(char)
50-
if flags & PyBUF_FORMAT == PyBUF_FORMAT:
51-
buffer.format = 'B'
52-
else:
53-
buffer.format = NULL
54-
buffer.ndim = 1
55-
if flags & PyBUF_ND == PyBUF_ND:
56-
buffer.shape = <Py_ssize_t*>calloc(1, sizeof(Py_ssize_t))
57-
buffer.shape[0] = GA_COMM_ID_BYTES
58-
else:
59-
buffer.shape = NULL
60-
if flags & PyBUF_STRIDES == PyBUF_STRIDES:
61-
buffer.strides = &buffer.itemsize
62-
else:
63-
buffer.strides = NULL
64-
buffer.suboffsets = NULL
65-
buffer.internal = NULL
66-
Py_INCREF(self)
67-
68-
def __releasebuffer__(self, Py_buffer* buffer):
69-
if buffer == NULL:
70-
raise BufferError, "NULL buffer view in releasebuffer"
71-
72-
if buffer.shape != NULL:
73-
free(buffer.shape)
74-
Py_DECREF(self)
75-
7641
def __richcmp__(this, that, int op):
7742
if type(this) != type(that):
7843
raise TypeError, "Cannot compare %s with %s" % (type(this), type(that))

pygpu/tests/test_collectives.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ def test_richcmp(self):
8888
with self.assertRaises(TypeError):
8989
a = cid2 > "asdfasfa"
9090

91-
def test_as_buffer(self):
92-
a = np.asarray(self.cid)
93-
assert np.allclose(a, self.cid.comm_id)
94-
a[:] = [ord(b'a')] * COMM_ID_BYTES
95-
assert np.allclose(a, self.cid.comm_id)
96-
97-
9891
@unittest.skipUnless(MPI_IMPORTED, "Needs mpi4py module")
9992
@unittest.skipIf(get_user_gpu_rank() == -1, "Collective operations supported on CUDA devices only")
10093
class TestGpuComm(unittest.TestCase):

0 commit comments

Comments
 (0)