Commit d21bbab
committed
fix: make non-root workers print to
The MPI-aware versions of the `writeheaders_data` and
`writeheaders_ranks` methods call `open(..., "w")` on every rank, not
just root, even though only root actually uses to the handles to print
data. All four ranks independently opening the same file path like this
(without any synchronisation) might lead to race conditions. Moreover,
only root's handles get closed at the end.
Fix this by assigning `devnull` to the handles for non-root workers, so
that the writing functions called later on still work (this is why
`nothing` is not acceptable) but they do not need to actually open the
true output files.devnull
1 parent 138eb2d commit d21bbab
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
255 | 266 | | |
256 | 267 | | |
257 | 268 | | |
258 | | - | |
| 269 | + | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
| |||
281 | 292 | | |
282 | 293 | | |
283 | 294 | | |
| 295 | + | |
284 | 296 | | |
285 | 297 | | |
286 | 298 | | |
287 | | - | |
| 299 | + | |
288 | 300 | | |
289 | 301 | | |
290 | 302 | | |
| |||
0 commit comments