Skip to content

Commit

Permalink
move default alloc_specs from libE() definition to alloc_funcs.defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jlnav committed Jan 27, 2020
1 parent 5185a22 commit d66f2cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions libensemble/alloc_funcs/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from libensemble.alloc_funcs.give_sim_work_first import give_sim_work_first

alloc_specs = {'alloc_f': give_sim_work_first,
'out': [('allocated', bool)],
'user': {'batch_mode': True, 'num_active_gens': 1}}
10 changes: 6 additions & 4 deletions libensemble/libE.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from libensemble.history import History
from libensemble.libE_manager import manager_main, ManagerException
from libensemble.libE_worker import worker_main
from libensemble.alloc_funcs.give_sim_work_first import give_sim_work_first
from libensemble.alloc_funcs import defaults
from libensemble.comms.comms import QCommProcess, Timeout
from libensemble.comms.logs import manager_logging_config
from libensemble.comms.tcp_mgr import ServerQCommManager, ClientQCommManager
Expand All @@ -41,9 +41,7 @@

def libE(sim_specs, gen_specs, exit_criteria,
persis_info={},
alloc_specs={'alloc_f': give_sim_work_first,
'out': [('allocated', bool)],
'user': {'batch_mode': True, 'num_active_gens': 1}},
alloc_specs=None,
libE_specs={},
H0=[]):
"""
Expand Down Expand Up @@ -111,6 +109,10 @@ def libE(sim_specs, gen_specs, exit_criteria,
3 = Current process is not in libEnsemble MPI communicator
"""

# Set default alloc_specs
if not alloc_specs:
alloc_specs = defaults.alloc_specs

# Set default comms
if 'comms' not in libE_specs:
libE_specs['comms'] = 'mpi'
Expand Down

0 comments on commit d66f2cb

Please sign in to comment.