|
25 | 25 |
|
26 | 26 |
|
27 | 27 | def count_of_sparse_all_reduce_calls(file_name): |
28 | | - cmd = 'grep sparse_all_reduce_op_handle ' + file_name + ' | grep in_numel | wc -l' |
| 28 | + # NOTE(Aurelius84): The log file contains some binary contents that causes error |
| 29 | + # while `grep`. So we add `-a` to fix it. |
| 30 | + # -a, --text equivalent to --binary-files=text, make binaries equivalent to text. |
| 31 | + cmd = 'grep -a sparse_all_reduce_op_handle ' + file_name + ' | grep in_numel | wc -l' |
29 | 32 | child = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) |
30 | 33 | result = child.communicate()[0] |
31 | 34 | print('test_info: result = ' + str(result)) |
32 | 35 |
|
33 | | - # note. in python3, result is b'num', != 'num' |
| 36 | + # NOTE: in python3, result is b'num', != 'num' |
34 | 37 | return int(result) |
35 | 38 |
|
36 | 39 |
|
@@ -59,7 +62,7 @@ def tearDown(self): |
59 | 62 | # only 1 layer use dgc now, run_step=5, rampup_begin_step=2, so 1 * (5 - 2) = 3 |
60 | 63 |
|
61 | 64 | # temp close this test. In python3 CI, the log is right, but the result |
62 | | - # has a problem, may be in multi process mode, log is not writed in time. |
| 65 | + # has a problem, may be in multi process mode, log is not written in time. |
63 | 66 | # self.assertEqual(result, 3) |
64 | 67 |
|
65 | 68 |
|
|
0 commit comments