Skip to content

Commit

Permalink
Merge 105da22 into 897978e
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Sep 5, 2019
2 parents 897978e + 105da22 commit 091240d
Show file tree
Hide file tree
Showing 7 changed files with 1,172 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ before_script:
- flake8 libensemble
- echo "export BALSAM_DB_PATH=~/test-balsam" > setbalsampath.sh
- source setbalsampath.sh
# Allow 10000 files to be open at once (critical for persistent_aposmm)
- ulimit -Sn 10000
# Set conda compilers to use new SDK instead of Travis default.
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "export CONDA_BUILD_SYSROOT=/Users/travis/build/Libensemble/sdk/MacOSX10.13.sdk" > setenv.sh;
Expand Down
13 changes: 7 additions & 6 deletions libensemble/alloc_funcs/start_only_persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,29 @@ def only_persistent_gens(W, H, sim_specs, gen_specs, alloc_specs, persis_info):
Work = {}
gen_count = count_persis_gens(W)

# If i is idle, but in persistent mode, and its calculated values have
# If i is in persistent mode, and any of its calculated values have
# returned, give them back to i. Otherwise, give nothing to i
for i in avail_worker_ids(W, persistent=True):
gen_inds = (H['gen_worker'] == i)
if np.all(H['returned'][gen_inds]):
if np.any(np.logical_and(H['returned'][gen_inds], ~H['given_back'][gen_inds])):
last_time_gen_gave_batch = np.max(H['gen_time'][gen_inds])
inds_of_last_batch_from_gen = H['sim_id'][gen_inds][H['gen_time'][gen_inds] == last_time_gen_gave_batch]
gen_work(Work, i,
sim_specs['in'] + [n[0] for n in sim_specs['out']],
sim_specs['in'] + [n[0] for n in sim_specs['out']] + [('sim_id')],
np.atleast_1d(inds_of_last_batch_from_gen), persis_info[i], persistent=True)

H['given_back'][inds_of_last_batch_from_gen] = True

task_avail = ~H['given']
for i in avail_worker_ids(W, persistent=False):
if np.any(task_avail):

# perform sim evaluations from existing runs (if they exist).
# perform sim evaluations (if they exist in History).
sim_ids_to_send = np.nonzero(task_avail)[0][0] # oldest point
sim_work(Work, i, sim_specs['in'], np.atleast_1d(sim_ids_to_send), persis_info[i])
task_avail[sim_ids_to_send] = False

elif gen_count == 0:
# Finally, generate points since there is nothing else to do.
# Finally, call a persistent generator as there is nothing else to do.
gen_count += 1
gen_work(Work, i, gen_specs['in'], [], persis_info[i],
persistent=True)
Expand Down

0 comments on commit 091240d

Please sign in to comment.