End a sequential execution of a section of code
(self)
| 36 | comm.Send([None, "B"], rank + 1, tag) |
| 37 | |
| 38 | def end(self): |
| 39 | """ |
| 40 | End a sequential execution of a section of code |
| 41 | """ |
| 42 | comm = self.comm |
| 43 | size = comm.Get_size() |
| 44 | if size == 1: |
| 45 | return |
| 46 | rank = comm.Get_rank() |
| 47 | ng = self.ng |
| 48 | tag = self.tag |
| 49 | if rank == (size - 1) or (rank % ng) == (ng - 1): |
| 50 | comm.Send([None, "B"], (rank + 1) % size, tag) |
| 51 | if rank == 0: |
| 52 | comm.Recv([None, "B"], size - 1, tag) |