Skip to content

Commit

Permalink
fixed bug with parallel iteration over last chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-chew committed Jun 19, 2024
1 parent 46fcc26 commit b8bb8a3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions runs/icon_merit_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def parallel_wrapper(grid, params, reader, writer):

print(n_cells)

chunk_sz = 100
chunk_start = 0
chunk_sz = 10
chunk_start = 20400
for chunk in range(chunk_start, n_cells, chunk_sz):
# writer object
sfx = "_" + str(chunk+chunk_sz)
Expand All @@ -256,8 +256,12 @@ def parallel_wrapper(grid, params, reader, writer):
# b = db.from_sequence(range(chunk), npartitions=100)
# results = b.map(pw_run)
# results = results.compute()
if chunk+chunk_sz > n_cells:
chunk_end = n_cells
else:
chunk_end = chunk+chunk_sz

for c_idx in range(chunk, chunk+chunk_sz):
for c_idx in range(chunk, chunk_end):
# pw_run(c_idx)
lazy_result = dask.delayed(pw_run)(c_idx)
lazy_results.append(lazy_result)
Expand Down

0 comments on commit b8bb8a3

Please sign in to comment.