| 27 | self.ctxt[ELAPSED_SEC] += end_time - start_time |
| 28 | |
| 29 | def write(self, args, tid): |
| 30 | # Avoid overwriting existing files as it could be artificially faster |
| 31 | if os.path.isfile(self.ctxt[FILE]): |
| 32 | os.remove(self.ctxt[FILE]) |
| 33 | |
| 34 | start_time = time.time() |
| 35 | torch.save(obj=self.ctxt[BUFFER], f=self.ctxt[FILE], _use_new_zipfile_serialization=self.zipfile_serialization) |
| 36 | end_time = time.time() |
| 37 | self.ctxt[ELAPSED_SEC] += end_time - start_time |
| 38 | |
| 39 | def _create_context(self, args, tid, read_op): |
| 40 | io_string = "Read" if read_op else "Write" |