Total Complexity | 1 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python |
||
2 | |||
3 | from map_parallel import map_parallel |
||
4 | from map_parallel import starmap_parallel |
||
5 | |||
6 | ARGS = [ |
||
7 | [3, 4, 5], |
||
8 | [5, 12, 13], |
||
9 | [1, 2, 3] |
||
10 | ] |
||
11 | |||
12 | |||
13 | def f(x, y, z): |
||
14 | return x * x + y * y == z * z |
||
15 | |||
16 | |||
17 | if __name__ == "__main__": |
||
18 | args = list(map(list, zip(*ARGS))) |
||
19 | truth = list(map(f, *args)) |
||
20 | res = map_parallel(f, *args, mode='mpi') |
||
21 | assert res == truth |
||
22 |