Skip to content

Commit

Permalink
Remove the buffer functionality for GpuCommCliqueId since it crashes …
Browse files Browse the repository at this point in the history
…hard in some case and isn't necessary.
  • Loading branch information
abergeron committed Aug 24, 2017
1 parent 61b7cac commit 8ac2448
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
35 changes: 0 additions & 35 deletions pygpu/collectives.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,6 @@ cdef class GpuCommCliqueId:
if comm_id is not None:
self.comm_id = comm_id

def __getbuffer__(self, Py_buffer* buffer, int flags):
if buffer == NULL:
raise BufferError, "NULL buffer view in getbuffer"

buffer.buf = <char*>self.c_comm_id.internal
buffer.obj = self
buffer.len = GA_COMM_ID_BYTES * sizeof(char)
buffer.readonly = 0
buffer.itemsize = sizeof(char)
if flags & PyBUF_FORMAT == PyBUF_FORMAT:
buffer.format = 'B'
else:
buffer.format = NULL
buffer.ndim = 1
if flags & PyBUF_ND == PyBUF_ND:
buffer.shape = <Py_ssize_t*>calloc(1, sizeof(Py_ssize_t))
buffer.shape[0] = GA_COMM_ID_BYTES
else:
buffer.shape = NULL
if flags & PyBUF_STRIDES == PyBUF_STRIDES:
buffer.strides = &buffer.itemsize
else:
buffer.strides = NULL
buffer.suboffsets = NULL
buffer.internal = NULL
Py_INCREF(self)

def __releasebuffer__(self, Py_buffer* buffer):
if buffer == NULL:
raise BufferError, "NULL buffer view in releasebuffer"

if buffer.shape != NULL:
free(buffer.shape)
Py_DECREF(self)

def __richcmp__(this, that, int op):
if type(this) != type(that):
raise TypeError, "Cannot compare %s with %s" % (type(this), type(that))
Expand Down
7 changes: 0 additions & 7 deletions pygpu/tests/test_collectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ def test_richcmp(self):
with self.assertRaises(TypeError):
a = cid2 > "asdfasfa"

def test_as_buffer(self):
a = np.asarray(self.cid)
assert np.allclose(a, self.cid.comm_id)
a[:] = [ord(b'a')] * COMM_ID_BYTES
assert np.allclose(a, self.cid.comm_id)


@unittest.skipUnless(MPI_IMPORTED, "Needs mpi4py module")
@unittest.skipIf(get_user_gpu_rank() == -1, "Collective operations supported on CUDA devices only")
class TestGpuComm(unittest.TestCase):
Expand Down

0 comments on commit 8ac2448

Please sign in to comment.