Skip to content

Commit 1b77179

Browse files
committed
Debugging output for pipe chunk distr
1 parent a8c84fe commit 1b77179

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/binding/python/openpmd_api/pipe/__main__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def parse_args(program_name):
118118
else:
119119
HAVE_MPI = False
120120

121-
debug = False
121+
debug = True
122122

123123

124124
class FallbackMPICommunicator:
@@ -354,10 +354,12 @@ def run(self, loggingfile):
354354
print("Opened input and output on rank {}.".format(self.comm.rank))
355355
sys.stdout.flush()
356356
dump_times = DumpTimes(loggingfile)
357+
self.dump_assignments = open(f"assignment_{self.comm.rank}.txt", "w")
357358
# In Linear read mode, global attributes are only present after calling
358359
# this method to access the first iteration
359360
inseries.parse_base()
360361
self.__copy(inseries, outseries, dump_times)
362+
self.dump_assignments.close()
361363
dump_times.close()
362364
del inseries
363365
del outseries
@@ -472,16 +474,18 @@ def __copy(self, src, dest, dump_times, current_path="/data/"):
472474
my_chunks = strategy.assign(chunk_table, self.inranks,
473475
self.outranks,
474476
self.comm.rank, self.comm.size)
477+
for_print = {source_chunk.source_id
478+
for source_chunk in my_chunks[self.comm.rank]}
479+
print(for_print)
475480
accum = 0
476481
for chunk in my_chunks[
477482
self.comm.rank] if self.comm.rank in my_chunks else []:
478483
if debug:
479484
end = chunk.offset.copy()
480485
for i in range(len(end)):
481486
end[i] += chunk.extent[i]
482-
print("{}\t{}/{}:\t{} -- {}".format(
483-
current_path, self.comm.rank, self.comm.size,
484-
chunk.offset, end))
487+
self.dump_assignments.write(
488+
f"{chunk.source_id}:\t{current_path}\t{self.comm.rank}/{self.comm.size}:\t{chunk.offset} -- {end}\n")
485489
accum += math.prod(chunk.extent)
486490
span = dest.store_chunk(chunk.offset, chunk.extent)
487491
self.loads.append(

0 commit comments

Comments
 (0)