-
Notifications
You must be signed in to change notification settings - Fork 1
Speed up 3 slow tests. #369
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
Changes from all commits
49f5a86
40dd179
01c799e
67444ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,8 +137,7 @@ def test_from_global_dim_data_irregular_block(self): | |
| ) | ||
| distribution = Distribution(self.context, glb_dim_data) | ||
| distarr = DistArray(distribution, dtype=int) | ||
| for i in range(global_size): | ||
| distarr[i] = i | ||
| distarr.toarray() | ||
|
|
||
| def test_from_global_dim_data_1d(self): | ||
| total_size = 40 | ||
|
|
@@ -180,9 +179,7 @@ def test_from_global_dim_data_bu(self): | |
| ) | ||
| distribution = Distribution(self.context, glb_dim_data) | ||
| distarr = DistArray(distribution, dtype=int) | ||
| for i in range(rows): | ||
| for j in range(cols): | ||
| distarr[i, j] = i*cols + j | ||
| distarr.toarray() | ||
|
|
||
| def test_from_global_dim_data_bc(self): | ||
| """ Test creation of a block-cyclic array. """ | ||
|
|
@@ -204,12 +201,11 @@ def test_from_global_dim_data_bc(self): | |
| },) | ||
| distribution = Distribution(self.context, global_dim_data) | ||
| distarr = DistArray(distribution, dtype=int) | ||
| for i in range(rows): | ||
| for j in range(cols): | ||
| distarr[i, j] = i*cols + j | ||
| distarr.toarray() | ||
| las = distarr.get_localarrays() | ||
| local_shapes = [la.local_shape for la in las] | ||
| self.assertSequenceEqual(local_shapes, [(3,5), (3,4), (2,5), (2,4)]) | ||
| self.assertSequenceEqual(local_shapes, | ||
| [(3, 5), (3, 4), (2, 5), (2, 4)]) | ||
|
|
||
| def test_from_global_dim_data_uu(self): | ||
| rows = 6 | ||
|
|
@@ -226,9 +222,7 @@ def test_from_global_dim_data_uu(self): | |
| ) | ||
| distribution = Distribution(self.context, glb_dim_data) | ||
| distarr = DistArray(distribution, dtype=int) | ||
| for i in range(rows): | ||
| for j in range(cols): | ||
| distarr[i, j] = i*cols + j | ||
| distarr.toarray() | ||
|
|
||
| def test_global_dim_data_local_dim_data_equivalence(self): | ||
| rows, cols = 5, 9 | ||
|
|
@@ -300,7 +294,6 @@ def test_global_dim_data_local_dim_data_equivalence(self): | |
| self.assertSequenceEqual(actual, expected) | ||
|
|
||
| def test_irregular_block_assignment(self): | ||
| global_shape = (5, 9) | ||
| global_dim_data = ( | ||
| { | ||
| 'dist_type': 'b', | ||
|
|
@@ -313,9 +306,7 @@ def test_irregular_block_assignment(self): | |
| ) | ||
| distribution = Distribution(self.context, global_dim_data) | ||
| distarr = DistArray(distribution, dtype=int) | ||
| for i in range(global_shape[0]): | ||
| for j in range(global_shape[1]): | ||
| distarr[i, j] = i + j | ||
| distarr.toarray() | ||
|
|
||
|
|
||
| class TestDistArrayCreation(unittest.TestCase): | ||
|
|
@@ -329,7 +320,7 @@ def tearDown(self): | |
| self.context.close() | ||
|
|
||
| def test___init__(self): | ||
| shape = (100, 100) | ||
| shape = (5, 5) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does making this change speed things up much? I'd expect the runtime of this to be essentially independent of the array's
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought so too, but this test is really slow for some reason. Local results are cut in half 0.3643 to 0.1543, no clue why.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's really surprising -- is the factor of 2 difference repeatable? The new array is 400 times smaller than the original, but the total number of roundtrips is unchanged. We should look into this one to figure out why. Does making the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be related to the client - controller communication since the message is sent 4 times. We are sending 100 elements instead of 40,000.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, this test is calling
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see -- that make sense. I didn't see the rest of the method in GH's diff view, so I thought the method ended with the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On a side note I was testing creating distarray's happens in constant time as expected. I confirmed this trying to reproduce the lag in this test. |
||
| distribution = Distribution.from_shape(self.context, shape, ('b', 'c')) | ||
| da = DistArray(distribution, dtype=int) | ||
| da.fill(42) | ||
|
|
||
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 presume the
toarray()call is equivalent to theforloop above?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 but not exactly. It iterates over the whole array (like the for loop) and calls
__getitem__. But it all happens on the client.The for loop has a round trip for every element and calls
__setitem__.