clpy icon indicating copy to clipboard operation
clpy copied to clipboard

Asynchronous memory transfer

Open LWisteria opened this issue 6 years ago • 5 comments

Currently, all async memory operation are implemented as sync.

  • https://github.com/fixstars/clpy/blob/3fd3b234e6c43ce3ba97642280ad902b2e1e7cc8/clpy/backend/memory.pyx#L300-L301
  • https://github.com/fixstars/clpy/blob/3fd3b234e6c43ce3ba97642280ad902b2e1e7cc8/clpy/backend/memory.pyx#L335-L336
  • https://github.com/fixstars/clpy/blob/3fd3b234e6c43ce3ba97642280ad902b2e1e7cc8/clpy/backend/memory.pyx#L407-L408
  • https://github.com/fixstars/clpy/blob/3fd3b234e6c43ce3ba97642280ad902b2e1e7cc8/clpy/backend/memory.pyx#L432-L433

They are should be implemented as async.

LWisteria avatar Sep 18 '18 05:09 LWisteria

@LWisteria When the source and destination of copy_from_device_async() are both device memory objects (cl_mem), should it raise an error, or execute EnqueueCopyBuffer just as in copy_from_device()?

ybsh avatar Jul 26 '19 05:07 ybsh

@ybsh I understand that your question is about clpy itself but not about this issue. If you suggest raising an error on copy_from_device() (and also on _async), please make an issue for it.

LWisteria avatar Jul 26 '19 05:07 LWisteria

@LWisteria Thank you for your advice, and sorry that was off-topic. Aside from the error handling issue above, I think it is necessary to migrate CuPy's Event/Stream classes first, as those async family take a CUDA stream as one of their arguments. Do you agree? If you do, could I open an issue for that?

ybsh avatar Jul 26 '19 11:07 ybsh

Regarding the migration of CUDA Stream, @LWisteria told me an issue for that has already been created: https://github.com/fixstars/clpy/issues/5

ybsh avatar Jul 31 '19 09:07 ybsh

This issue would be pending because _async functions are not used in cupy tests and even in chainer.

LWisteria avatar Jul 31 '19 09:07 LWisteria