Skip to content

Shared memory and numpy arrays #1329

Answered by sighingnow
PaulRudin asked this question in Q&A
Discussion options

You must be logged in to vote

@PaulRudin numpy.ndarray.base.data is not the memory address of the array payload. With vineyard, get the same object twice with the same client instance, the memory address should be the same.

In [3]: import vineyard
import
In [4]: import numpy as np

In [5]: client = vineyard.connect("/tmp/vineyard.sock")

In [6]: object_id = client.put(np.ones((10000, 1000)))

In [7]: r1 = client.get(object_id)

In [8]: r2 = client.get(object_id)

In [9]: r1 is r2
Out[9]: False

In [10]: r1.__array_interface__["data"]
Out[10]: (140492393889856, True)

In [11]: r2.__array_interface__["data"]
Out[11]: (140492393889856, True)

In [12]: r1.__array_interface__["data"] == r2.__array_interface__["data"]
Out[12]…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@PaulRudin
Comment options

@sighingnow
Comment options

@sighingnow
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by PaulRudin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants