-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[BUGFIX] copy graph index to shared memory. #634
Conversation
@@ -889,6 +914,9 @@ class ImmutableGraph: public GraphInterface { | |||
if (!in_csr_) { | |||
if (out_csr_) { | |||
const_cast<ImmutableGraph*>(this)->in_csr_ = out_csr_->Transpose(); | |||
if (out_csr_->IsSharedMem()) | |||
LOG(WARNING) << "We just construct an in-CSR from a shared-memory out CSR. " | |||
<< "It may dramatically increase memory consumption."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? Is the in_csr
also in shared memory? Is there any solution to this warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add this warning in case this happens. We could make sure the newly constructed csr is also in shared memory.
@@ -318,7 +318,12 @@ class SharedMemoryStoreServer(object): | |||
""" | |||
def __init__(self, graph_data, edge_dir, graph_name, multigraph, num_workers, port): | |||
self.server = None | |||
if isinstance(graph_data, (GraphIndex, DGLGraph)): | |||
if isinstance(graph_data, GraphIndex): | |||
graph_data = graph_data.copyto_shared_mem(edge_dir, _get_graph_path(graph_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should make shared memory as a special device type (similar to kDLCPUPinned in current DLPack). I created a issue in DLPack (dmlc/dlpack#41) for this. This is definitely sth after this release though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I agree.
Could you briefly update the PR description about what is the bug? |
Description
If users provide a constructed graph index to SharedMemoryStoreServer, the graph index may not be in shared memory. We have to copy it to shared memory if it's not.
In addition, this PR gives shared memory for in-CSR and out-CSR different names. This is useful if a shared-memory graph index requires both in-CSR and out-CSR.
Checklist
Please feel free to remove inapplicable items for your PR.
or have been fixed to be compatible with this change