Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: generic interface for pyamgx.Vector.download( ) #26

Open
qingshanchen opened this issue Feb 8, 2021 · 2 comments
Open

Comments

@qingshanchen
Copy link

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!

@shwina
Copy link
Owner

shwina commented Mar 1, 2021

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

@qingshanchen
Copy link
Author

qingshanchen commented Mar 2, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants