Skip to content

Commit 5c96085

Browse files
committed
CI fixes
1 parent 856e851 commit 5c96085

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

include/openPMD/ChunkInfo.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ namespace chunk_assignment
133133
* Merge the unassigned chunks into the partially assigned table.
134134
* @param in Meta information on writing processes, e.g. hostnames.
135135
* @param out Meta information on reading processes, e.g. hostnames.
136+
* @param my_rank Rank identifier for the current process. Will be
137+
* considered by some distribution strategies that may be called
138+
* for only a subselection of the data space (e.g. for
139+
* distributing data within processes on the same compute node
140+
* in a cluster).
141+
* @param num_ranks Number of processes among which chunks are to be
142+
* distributed. Will be considered by some distribution
143+
* strategies that may be called for only a subselection of the
144+
* data space (e.g. for distributing data within processes on the
145+
* same compute node in a cluster).
136146
* @return ChunkTable A table that assigns chunks to reading processes.
137147
*/
138148
virtual Assignment assign(
@@ -174,6 +184,16 @@ namespace chunk_assignment
174184
* Merge the unassigned chunks into the partially assigned table.
175185
* @param in Meta information on writing processes, e.g. hostnames.
176186
* @param out Meta information on reading processes, e.g. hostnames.
187+
* @param my_rank Rank identifier for the current process. Will be
188+
* considered by some distribution strategies that may be called
189+
* for only a subselection of the data space (e.g. for
190+
* distributing data within processes on the same compute node
191+
* in a cluster).
192+
* @param num_ranks Number of processes among which chunks are to be
193+
* distributed. Will be considered by some distribution
194+
* strategies that may be called for only a subselection of the
195+
* data space (e.g. for distributing data within processes on the
196+
* same compute node in a cluster).
177197
* @return PartialAssignment Two chunktables, one of leftover chunks
178198
* that were not assigned and one that assigns chunks to
179199
* reading processes.

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def assign(self, assignment, ranks_in, ranks_out, my_rank, num_ranks):
127127
assignment.assigned[my_rank].append(element)
128128
return assignment
129129

130+
130131
class IncreaseGranularity(io.PartialStrategy):
131132
def __init__(
132133
self,
@@ -180,13 +181,15 @@ def hostname_to_hostgroup(ordered_hosts, granularity):
180181

181182
# Creates `in_ranks` and `out_ranks` for the inner call, based on the
182183
# meta hosts created above
183-
def inner_rank_assignment(outer_rank_assignment, hostname_to_hostgroup):
184+
def inner_rank_assignment(
185+
outer_rank_assignment, hostname_to_hostgroup):
184186
res = {}
185187
for (rank, hostname) in outer_rank_assignment.items():
186188
res[rank] = hostname_to_hostgroup[hostname]
187189
return res
188190

189-
self.in_ranks_inner = inner_rank_assignment(in_ranks, in_hostname_to_hostgroup)
191+
self.in_ranks_inner = \
192+
inner_rank_assignment(in_ranks, in_hostname_to_hostgroup)
190193
self.out_ranks_inner = inner_rank_assignment(
191194
out_ranks, out_hostname_to_hostgroup
192195
)
@@ -202,9 +205,12 @@ def inner_rank_assignment(outer_rank_assignment, hostname_to_hostgroup):
202205
# }
203206

204207
return self.inner_distribution.assign(
205-
assignment, self.in_ranks_inner, self.out_ranks_inner, my_rank, num_ranks
208+
assignment,
209+
self.in_ranks_inner, self.out_ranks_inner,
210+
my_rank, num_ranks
206211
)
207212

213+
208214
class MergingStrategy(io.Strategy):
209215
def __init__(self, inner_strategy):
210216
super().__init__()
@@ -218,7 +224,8 @@ def assign(self, assignment, in_ranks, out_ranks):
218224
for in_rank, chunks in merged.items():
219225
for chunk in chunks:
220226
assignment.append(
221-
io.WrittenChunkInfo(chunk.offset, chunk.extent, in_rank)
227+
io.WrittenChunkInfo(
228+
chunk.offset, chunk.extent, in_rank)
222229
)
223230
return res
224231

@@ -241,7 +248,7 @@ def assign(self, assignment, in_ranks, out_ranks):
241248
# print(f" [{chunk.offset}-{chunk.extent}]", end='')
242249
# print()
243250

244-
#Example how to implement a simple strategy in Python
251+
# Example how to implement a simple strategy in Python
245252
class LoadAll(io.Strategy):
246253

247254
def __init__(self):
@@ -266,8 +273,8 @@ def distribution_strategy(dataset_extent,
266273
strategy_identifier = 'hostname_binpacking_slicedataset' # default
267274
match = re.search('hostname_(.*)_(.*)', strategy_identifier)
268275
if match is not None:
269-
inside_node = distribution_strategy(dataset_extent,
270-
strategy_identifier=match.group(1))
276+
inside_node = distribution_strategy(
277+
dataset_extent, strategy_identifier=match.group(1))
271278
second_phase = distribution_strategy(
272279
dataset_extent,
273280
strategy_identifier=match.group(2))

0 commit comments

Comments
 (0)