Skip to content

Commit

Permalink
Merge c27d72b into 926d0fa
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Oct 8, 2019
2 parents 926d0fa + c27d72b commit 114a15a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions docs/tutorials/local_sine_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ An available libEnsemble worker will call this generator function with the follo

Later on, we'll populate ``gen_specs`` and ``persis_info`` in our calling script.

For now, create a new Python file named 'generator.py'. Write the following:
For now, create a new Python file named ``generator.py``. Write the following:

.. code-block:: python
:linenos:
Expand Down Expand Up @@ -117,7 +117,7 @@ functions perform calculations based on values from the generator function.
The only new parameter here is :ref:`sim_specs<datastruct-sim-specs>`, which serves
a similar purpose to ``gen_specs``.

Create a new Python file named 'simulator.py'. Write the following:
Create a new Python file named ``simulator.py``. Write the following:

.. code-block:: python
:linenos:
Expand Down Expand Up @@ -148,13 +148,13 @@ Calling Script
Now we can write the calling script that configures our generator and simulator
functions and calls libEnsemble.

Create an empty Python file named 'calling_script.py'.
Create an empty Python file named ``calling_script.py``.
In this file, we'll start by importing NumPy, libEnsemble, and the generator and
simulator functions we just created.

Next, in a dictionary called :ref:`libE_specs<datastruct-libe-specs>` we'll specify
the number of workers and the type of manager/worker communication libEnsemble will
use. Our communication method, 'local', refers to Python's Multiprocessing.
use. Our communication method, ``'local'``, refers to Python's Multiprocessing.

.. code-block:: python
:linenos:
Expand All @@ -177,7 +177,6 @@ inputs and outputs from those functions to expect.
:linenos:
gen_specs = {'gen_f': gen_random_sample, # Our generator function
'in': ['sim_id'], # Input field names. 'sim_id' necessary default
'out': [('x', float, (1,))], # gen_f output (name, type, size).
'lower': np.array([-3]), # lower boundary for random sampling.
'upper': np.array([3]), # upper boundary for random sampling.
Expand Down Expand Up @@ -242,8 +241,8 @@ In this arrangement, our output values are listed on the far-left with the gener
values being the fourth column from the right.

Two additional log files should also have been created.
'ensemble.log' contains debugging or informational logging output from libEnsemble,
while 'libE_stats.txt' contains a quick summary of all calculations performed.
``ensemble.log`` contains debugging or informational logging output from libEnsemble,
while ``libE_stats.txt`` contains a quick summary of all calculations performed.

I graphed my output using Matplotlib, coloring entries by which worker performed
the simulation:
Expand Down
1 change: 0 additions & 1 deletion examples/tutorials/tutorial_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
libE_specs = {'nprocesses': nworkers, 'comms': 'local'}

gen_specs = {'gen_f': gen_random_sample, # Our generator function
'in': ['sim_id'], # Input field names. 'sim_id' necessary default
'out': [('x', float, (1,))], # gen_f output (name, type, size).
'lower': np.array([-3]), # lower boundary for random sampling.
'upper': np.array([3]), # upper boundary for random sampling.
Expand Down
1 change: 0 additions & 1 deletion examples/tutorials/tutorial_calling_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
is_master = (MPI.COMM_WORLD.Get_rank() == 0) # master process has MPI rank 0

gen_specs = {'gen_f': gen_random_sample, # Our generator function
'in': ['sim_id'], # Input field names. 'sim_id' necessary default
'out': [('x', float, (1,))], # gen_f output (name, type, size).
'lower': np.array([-3]), # lower boundary for random sampling.
'upper': np.array([3]), # upper boundary for random sampling.
Expand Down
5 changes: 4 additions & 1 deletion libensemble/alloc_funcs/give_sim_work_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def give_sim_work_first(W, H, sim_specs, gen_specs, alloc_specs, persis_info):

# Give gen work
gen_count += 1
gen_work(Work, i, gen_specs['in'], range(len(H)), persis_info[i])
if 'in' in gen_specs and len(gen_specs['in']):
gen_work(Work, i, gen_specs['in'], range(len(H)), persis_info[i])
else:
gen_work(Work, i, [], [], persis_info[i])

return Work, persis_info
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
sim_specs = {'sim_f': sim_f, 'in': ['x'], 'out': [('f', float)]}

gen_specs = {'gen_f': gen_f,
'in': ['sim_id'],
'out': [('x', float, (1,))],
'lb': np.array([-3]),
'ub': np.array([3]),
Expand Down

0 comments on commit 114a15a

Please sign in to comment.