Skip to content

Commit 4aa386f

Browse files
committed
Update fast_alloc
1 parent 6f713dc commit 4aa386f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

libensemble/alloc_funcs/fast_alloc.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ def give_sim_work_first(W, H, sim_specs, gen_specs, alloc_specs, persis_info, li
3232
Work = {}
3333
gen_in = gen_specs.get("in", [])
3434

35-
persis_info = support.skip_canceled_points(H, persis_info)
36-
3735
# Give sim work if possible
3836
if persis_info["next_to_give"] < len(H):
3937
for wid in support.avail_worker_ids(gen_workers=False):
38+
persis_info = support.skip_canceled_points(H, persis_info)
4039
try:
4140
Work[wid] = support.sim_work(wid, H, sim_specs["in"], [persis_info["next_to_give"]], [])
4241
except InsufficientFreeResources:
4342
break
4443
persis_info["next_to_give"] += 1
4544

4645
# Give gen work if possible
47-
elif gen_count < user.get("num_active_gens", gen_count + 1):
46+
if persis_info["next_to_give"] >= len(H):
4847
for wid in support.avail_worker_ids(gen_workers=True):
49-
return_rows = range(len(H)) if gen_in else []
50-
try:
51-
Work[wid] = support.gen_work(wid, gen_in, return_rows, persis_info.get(wid))
52-
except InsufficientFreeResources:
53-
break
54-
gen_count += 1
55-
persis_info["total_gen_calls"] += 1
48+
if gen_count < user.get("num_active_gens", gen_count + 1):
49+
return_rows = range(len(H)) if gen_in else []
50+
try:
51+
Work[wid] = support.gen_work(wid, gen_in, return_rows, persis_info.get(wid))
52+
except InsufficientFreeResources:
53+
break
54+
gen_count += 1
55+
persis_info["total_gen_calls"] += 1
5656

5757
return Work, persis_info

0 commit comments

Comments
 (0)