pyamgx
pyamgx copied to clipboard
Feature request: generic interface for pyamgx.Vector.download( )
Currently pyamgx.Vector has the method download( ) for numpy arrays, and download_raw( ) for raw pointers (possibly on GPU?) Raw pointers are rather difficult to use. I hope that a generic interface can be implemented for the Vector.download( ) method, which can download data either to a numpy array variable, or a cupy array variable, just like the Vector.upload( ) method and the Matrix.upload( ) method. Many thanks!
A single API for copying to both host and device is a bit confusing. What do you think about distinct download_host
and download_device
functions?
class Vector:
def download_host(self, out: np.ndarray=None):
"""Copies the contents of the vector to the given NumPy array `out`.
If `out` is not given, a new NumPy array is returned
"""
pass
def download_device(self, out: cp.ndarray=None):
"""Copies the contents of the vector to the given CuPy array `out`.
If `out` is not given, a new CuPy array is returned
"""
pass
Yes, this should work. Thanks a lot!
I agree that a single download for both host and device is confusing. The current download_raw is a bit primitive.
On Mar 1, 2021, at 6:36 PM, Ashwin Srinath [email protected] wrote:
A single API for both host and device is a bit confusing. What do you think about distinct download_host and download_device functions?
class Vector:
def download_host(self, out: np.ndarray=None):
"""Copies the contents of the vector to the given NumPy array `out`.
If `out` is not given, a new NumPy array is returned
"""
pass
def download_device(self, out: cp.ndarray=None):
"""Copies the contents of the vector to the given CuPy array `out`.
If `out` is not given, a new CuPy array is returned
"""
pass
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/shwina/pyamgx/issues/26#issuecomment-788400283, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA75WFFG44FA6BVY7Z6S7ILTBQQHHANCNFSM4XJPT2IQ.