Skip to content

Conversation

@kylasa
Copy link
Collaborator

@kylasa kylasa commented Mar 10, 2023

Description

Webgraph dataset edge files have '\t' as the delimiter. But the pipeline, by default assumes ' ' as the delimiter because of which it fails to read webgraph files.

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • I've leverage the tools to beautify the python and c++ code.
  • The PR is complete and small, read the Google eng practice (CL equals to PR) to understand more about small PR. In DGL, we consider PRs with less than 200 lines of core code change are small (example, test and documentation could be exempted).
  • All changes have test coverage
  • Code is well-documented
  • To the best of my 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
  • If the PR is for a new model/paper, I've updated the example index here.

Changes

@kylasa kylasa requested a review from Rhett-Ying March 10, 2023 23:19
@kylasa kylasa self-assigned this Mar 10, 2023
@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 10, 2023

To trigger regression tests:

  • @dgl-bot run [instance-type] [which tests] [compare-with-branch];
    For example: @dgl-bot run g4dn.4xlarge all dmlc/master or @dgl-bot run c5.9xlarge kernel,api dmlc/master

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 11, 2023

Commit ID: 30192c4

Build ID: 1

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

@frozenbugs frozenbugs requested review from frozenbugs and removed request for Rhett-Ying March 13, 2023 02:51
@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 15, 2023

Commit ID: b928ddb6f8032295950eb2d6b9bdffded62e3d21

Build ID: 2

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Mar 15, 2023

Commit ID: cb2d273

Build ID: 3

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

kylasa added 2 commits April 20, 2023 10:36
1. reverting back to the original pytest_utils.py. This will remove the random delimiter used when creating edge files.
@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 20, 2023

Commit ID: 9957ead6707b97478b307e106e64b666126b767d

Build ID: 4

Status: ⚪️ CI test cancelled due to overrun.

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 20, 2023

Commit ID: 2b6094be13127c666b1873734d270bb0fe1dfacf

Build ID: 5

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 25, 2023

Commit ID: ad9abfbe8a3e83e3b648d01373a668cac448eff4

Build ID: 6

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 25, 2023

Commit ID: d01a283

Build ID: 7

Status: ❌ CI test failed in Stage [Distributed Torch CPU Unit test].

Report path: link

Full logs path: link

@dgl-bot
Copy link
Collaborator

dgl-bot commented Apr 27, 2023

Commit ID: aa80a6e

Build ID: 8

Status: ✅ CI test succeeded.

Report path: link

Full logs path: link

Copy link
Contributor

@thvasilo thvasilo left a comment

Choose a reason for hiding this comment

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

I've mentioned this before: The amount of setup required for the tests is very large, and they seem to be duplicating the implementation. As a result the tests are brittle and refactoring the code will definitely lead to us having to change the test as well.

I'm also concerned that the values as noted in the comments do not seem to follow an expected pattern yet the tests pass. Are we sure we are testing the right things here?

Please take another look at the comments, fix what is needed and we can take a second look.

Let's ask the question: what's the minimum amount of setup possible to test the functionality that this code change adds.

assert np.all(exp_etype_ids == edge_dict[constants.ETYPE_ID])

# validate edge_tids here.
assert edge_tids["n1:e1:n1"][0] == (
Copy link
Contributor

Choose a reason for hiding this comment

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

For constants like "n1:e1:n1" better to define them as a file constant EDGE_TYPE = "n1:e1:n1" and use the variable throughout the code.



def _validate_edges(
rank, world_size, num_chunks, edge_dict, edge_tids, schema_map
Copy link
Contributor

Choose a reason for hiding this comment

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

edge_dict is not in the docstring

edge_feats.append(data)

if len(edge_feats) == 0:
actual_results = edge_features["n1:e1:n1/edge_feat_1/0"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here define constants and use something like f"{EDGE_TYPE}/{FEATURE_NAME}/0"

else:
edge_feats = np.concatenate(edge_feats)

# assert
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove

edge_feats = np.concatenate(edge_feats)

# assert
assert np.all(
Copy link
Contributor

Choose a reason for hiding this comment

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

Use numpy.testing.assert_array_equal

Comment on lines +175 to +182
schema["edge_type"] = ["n1:e1:n1"]
schema["node_type"] = ["n1"]

edges = {}
edges["n1:e1:n1"] = {}
edges["n1:e1:n1"]["format"] = {}
edges["n1:e1:n1"]["format"]["name"] = edge_fmt
edges["n1:e1:n1"]["format"]["delimiter"] = edge_fmt_del
Copy link
Contributor

Choose a reason for hiding this comment

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

Use constants


# Make sure that the spawned process, mimicing ranks/workers, did
# not generate any errors or assertion failures
assert len(sh_dict) == 0, f"Spawned processes reported some errors !!!"
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the user know which errors were encountered?



@pytest.mark.parametrize(
"world_size, num_chunks, num_parts", [[1, 1, 4], [4, 1, 4]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we keep num_chunks to 1? Can we add one case for [4,4,4]?

Comment on lines +88 to +90
data = np.arange(10, dtype=np.int32)
for _ in range(9):
data = np.vstack((data, np.arange(10, dtype=np.int32) + 10 * idx))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct?

idx = 0
In [40]: data
Out[40]:
array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], dtype=int32)

idx = 1
In [43]: data
Out[43]:
array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
       [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]], dtype=int32)

In [44]: idx = 2

In [46]: data
Out[46]:
array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
       [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]], dtype=int32)

Comment on lines +129 to +134
data = np.arange(100, 110, dtype=np.int64)
for _ in range(9):
data = np.vstack(
(data, np.arange(100, 110, dtype=np.int64) + 100 * idx)
)
node_feats.append(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct?

idx = 0

In [48]: data = np.arange(100, 110, dtype=np.int64)
    ...: for _ in range(9):
    ...:     data = np.vstack(
    ...:         (data, np.arange(100, 110, dtype=np.int64) + 100 * idx)
    ...:     )
    ...: data
Out[48]:
array([[100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [100, 101, 102, 103, 104, 105, 106, 107, 108, 109]])

In [49]: idx = 1

In [50]: data = np.arange(100, 110, dtype=np.int64)
    ...: for _ in range(9):
    ...:     data = np.vstack(
    ...:         (data, np.arange(100, 110, dtype=np.int64) + 100 * idx)
    ...:     )
    ...: data
Out[50]:
array([[100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209],
       [200, 201, 202, 203, 204, 205, 206, 207, 208, 209]])

In [51]: idx = 2

In [52]: data = np.arange(100, 110, dtype=np.int64)
    ...: for _ in range(9):
    ...:     data = np.vstack(
    ...:         (data, np.arange(100, 110, dtype=np.int64) + 100 * idx)
    ...:     )
    ...: data
Out[52]:
array([[100, 101, 102, 103, 104, 105, 106, 107, 108, 109],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309],
       [300, 301, 302, 303, 304, 305, 306, 307, 308, 309]])

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.

4 participants