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

[BUGFIX] copy graph index to shared memory. #634

Merged
merged 13 commits into from
Jun 12, 2019

Conversation

zheng-da
Copy link
Collaborator

@zheng-da zheng-da commented Jun 10, 2019

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.

  • The PR title starts with [$CATEGORY] (such as [Model], [Doc], [Feature]])
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented
  • To the my best knowledge, examples are either not affected by this change,
    or have been fixed to be compatible with this change
  • Related issue is referred in this PR

@@ -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.";
Copy link
Member

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?

Copy link
Collaborator Author

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))
Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree.

@jermainewang
Copy link
Member

Could you briefly update the PR description about what is the bug?

@zheng-da zheng-da mentioned this pull request Jun 10, 2019
6 tasks
@zheng-da zheng-da merged commit 94ecb8e into dmlc:master Jun 12, 2019
@zheng-da zheng-da deleted the fix_shared_mem1 branch June 15, 2019 22:51
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

Successfully merging this pull request may close these issues.

3 participants