Skip to content

Commit e4d4b08

Browse files
committed
refactor fast_alloc for gen workers
1 parent eacf46f commit e4d4b08

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libensemble/alloc_funcs/fast_alloc.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ 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-
for wid in support.avail_worker_ids():
36-
persis_info = support.skip_canceled_points(H, persis_info)
35+
persis_info = support.skip_canceled_points(H, persis_info)
3736

38-
# Give sim work if possible
39-
if persis_info["next_to_give"] < len(H):
37+
# Give sim work if possible
38+
if persis_info["next_to_give"] < len(H):
39+
for wid in support.avail_worker_ids(gen_workers=False):
4040
try:
4141
Work[wid] = support.sim_work(wid, H, sim_specs["in"], [persis_info["next_to_give"]], [])
4242
except InsufficientFreeResources:
4343
break
4444
persis_info["next_to_give"] += 1
4545

46-
elif gen_count < user.get("num_active_gens", gen_count + 1):
47-
# Give gen work
46+
# Give gen work if possible
47+
elif gen_count < user.get("num_active_gens", gen_count + 1):
48+
for wid in support.avail_worker_ids(gen_workers=True):
4849
return_rows = range(len(H)) if gen_in else []
4950
try:
5051
Work[wid] = support.gen_work(wid, gen_in, return_rows, persis_info.get(wid))

0 commit comments

Comments
 (0)