Post-processing: Store rank and thread information in a single array#235
Post-processing: Store rank and thread information in a single array#235Ed Hone (EdHone) merged 8 commits intoMetOffice:mainfrom
Conversation
Oakley Brunt (oakleybrunt)
left a comment
There was a problem hiding this comment.
Thanks Ed, a couple notes regarding documentation but the core functionality looks robust to me. A good change :)
| sline = line.split() | ||
| if len(sline) > 0: # Line contains data | ||
| if sline[0].isdigit(): # Calliper lines start with a digit | ||
| if "Task" in sline: |
There was a problem hiding this comment.
I would probably change this to something that definitely can't be in a calliper line. Someone could have a calliper called "Task" and that would then break this line.
| if "Task" in sline: | |
| if "MPI rank ID" in sline: |
There was a problem hiding this comment.
Good point!
There was a problem hiding this comment.
Doesnt quite work as you suggested as the line is already split at this point - I've changed it to if sline[0] == "Task" which should capture the condition more robustly and rule out the possibility of the case you suggested above
| while True: | ||
| try: | ||
| start = self.rank.index(rank, start) | ||
| results.append(start) | ||
| start += 1 | ||
| except ValueError: | ||
| return results |
There was a problem hiding this comment.
This could use some comments, it's not the easiest to understand.
| while True: | |
| try: | |
| start = self.rank.index(rank, start) | |
| results.append(start) | |
| start += 1 | |
| except ValueError: | |
| return results | |
| while True: | |
| try: | |
| # Get the index for the first occurrence of `rank` after `start` | |
| start = self.rank.index(rank, start) | |
| # Add the index to the list | |
| results.append(start) | |
| # Move our start position to the index after the rank just found | |
| start += 1 | |
| except ValueError: | |
| return results |
| while True: | ||
| try: | ||
| start = self.thread.index(thread, start) | ||
| results.append(start) | ||
| start += 1 | ||
| except ValueError: | ||
| return results |
There was a problem hiding this comment.
Same here, a couple comments would help, e.g.:
| while True: | |
| try: | |
| start = self.thread.index(thread, start) | |
| results.append(start) | |
| start += 1 | |
| except ValueError: | |
| return results | |
| while True: | |
| try: | |
| # Get the index for the first occurrence of `thread` after `start` | |
| start = self.thread.index(thread, start) | |
| # Add the index to the list | |
| results.append(start) | |
| # Move our start position to the index after the rank just found | |
| start += 1 | |
| except ValueError: | |
| return results |
There was a problem hiding this comment.
I've changed the variable names around and added a comment to (hopefully) make things a bit easier to follow
There was a problem hiding this comment.
Is this still required after the changes to VernierReader?
There was a problem hiding this comment.
Good catch
|
Hopefully I've addressed your comments in the latest commit Oakley Brunt (@oakleybrunt) - back to you |
Description
This PR unifies the representation for multi-threaded callipers. This is achieved with the same single-data-list approach as before, but the rank and thread information is also stored in the calliper. The
getmethod has been extended to accept the thread and rank IDs as arguments and should now become the primary (and only) way to get subsets of data from theVernierDataandVernierDataCollationobjects, i.e.:A future issue should be opened to make the
dataattribute of theVernierDataclass 'private' (i.e. rename to_data).Linked issues
Closes #232
Closes #228
Type of change
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: