Skip to content

Commit 3cdef05

Browse files
committed
Debugging output for pipe chunk distr
1 parent 56d81cd commit 3cdef05

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
@@ -475,16 +477,18 @@ def __copy(self, src, dest, dump_times, current_path="/data/"):
475477
my_chunks = strategy.assign(chunk_table, self.inranks,
476478
self.outranks,
477479
self.comm.rank, self.comm.size)
480+
for_print = {source_chunk.source_id
481+
for source_chunk in my_chunks[self.comm.rank]}
482+
print(for_print)
478483
accum = 0
479484
for chunk in my_chunks[
480485
self.comm.rank] if self.comm.rank in my_chunks else []:
481486
if debug:
482487
end = chunk.offset.copy()
483488
for i in range(len(end)):
484489
end[i] += chunk.extent[i]
485-
print("{}\t{}/{}:\t{} -- {}".format(
486-
current_path, self.comm.rank, self.comm.size,
487-
chunk.offset, end))
490+
self.dump_assignments.write(
491+
f"{chunk.source_id}:\t{current_path}\t{self.comm.rank}/{self.comm.size}:\t{chunk.offset} -- {end}\n")
488492
accum += math.prod(chunk.extent)
489493
span = dest.store_chunk(chunk.offset, chunk.extent)
490494
self.loads.append(

0 commit comments

Comments
 (0)