Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
097cea1
bump some dev dependencies, add some missing docs dependencies
jlnav Jan 3, 2025
13f1d82
trying to reduce some of the listed example gen funcs in some section…
jlnav Jan 6, 2025
bfe1a46
some simplifying language in aposmm.rst
jlnav Jan 7, 2025
dfeb9a0
some cleanup, including replacing some single-quotes with double-quot…
jlnav Jan 7, 2025
52ee430
Merge branch 'develop' into docs/generator_section_refactor
jlnav Jan 7, 2025
64ddfca
decrement matplotlib in pyproject.toml, add links to community exampl…
jlnav Jan 15, 2025
af3896c
some rearranging, including having index under Examples, will fill wi…
jlnav Jan 16, 2025
771db72
Merge remote-tracking branch 'origin/develop' into docs/generator_sec…
shuds13 Feb 19, 2025
8a4f2c7
New intro line focussed on supercomputers
shuds13 Feb 19, 2025
81e6813
Fix gpCAM rst file
shuds13 Feb 19, 2025
40b2725
Alternative layout of gen examples
shuds13 Feb 19, 2025
695c3ea
update gens
shuds13 Feb 19, 2025
88366cf
update gens
shuds13 Feb 19, 2025
6f37765
Update wording for uniform_or_localopt
shuds13 Feb 20, 2025
d08462d
Add examples to tasmanian
shuds13 Feb 20, 2025
c7c10c4
Add missing kill_canceled_sims
shuds13 Feb 20, 2025
9789fd2
Add examples to Surmise
shuds13 Feb 20, 2025
d223383
Update gen docs
shuds13 Feb 21, 2025
e2cd95c
Update APOSMM docs
shuds13 Feb 21, 2025
728a246
Update sampling generator docs
shuds13 Feb 21, 2025
b1b0b22
cleanup gen funcs
shuds13 Feb 21, 2025
0c0e949
Remove mistaken file
shuds13 Feb 21, 2025
a2839fa
Add correct var resources doc file
shuds13 Feb 21, 2025
900584b
Update sim funcs examples
shuds13 Feb 21, 2025
d3e050e
Add info to sim funcs docs
shuds13 Feb 21, 2025
86a2995
Split forces sim func examples
shuds13 Feb 21, 2025
8763292
Add multi-app sim to docs and update links
shuds13 Feb 21, 2025
cf63cf8
Make Ax>=0.5.0 required
shuds13 Feb 21, 2025
904c06e
Prevent failure to build docs from Ax warning
shuds13 Feb 21, 2025
41c0b53
Minor fixes for docs
shuds13 Feb 21, 2025
43f927a
Mock pyre_extensions
shuds13 Feb 21, 2025
d2061c4
Mock torch
shuds13 Feb 21, 2025
c1e3d69
Update forces calling script example
shuds13 Feb 22, 2025
8df89d4
Stop # noqa appearing in docs
shuds13 Feb 25, 2025
f171db8
Highlight start_only_persistent
shuds13 Feb 25, 2025
3661ea4
Add alloc funcs in examples
shuds13 Feb 25, 2025
04d35b6
alloc docstring fixes
shuds13 Feb 25, 2025
da5dc59
Formatting fix
shuds13 Feb 25, 2025
1fe7221
Merge pull request #1519 from Libensemble/docs/alt_gen_refactor
shuds13 Feb 26, 2025
93f0846
Formatting fixes
shuds13 Feb 26, 2025
a14d045
Update examples intro
shuds13 Feb 26, 2025
d237c65
Merge branch 'develop' into docs/generator_section_refactor
jlnav Feb 26, 2025
3e97272
bump dev dependencies, "fix" noqa strip line
jlnav Feb 26, 2025
90ced44
specify Community Examples repository alongside regression tests for …
jlnav Feb 27, 2025
7716696
Add sim func for forces with input file
shuds13 Mar 5, 2025
c8bfdaa
Reorder build_forces lines and link from examples
shuds13 Mar 6, 2025
8c06276
Add example usage to mock sim docs
shuds13 Mar 6, 2025
ee9cbf6
Format mock_sim
shuds13 Mar 6, 2025
cba6ff6
Revert parameter formatting in start_only_persistent
shuds13 Mar 6, 2025
437cab3
Re-sorting for gens
jmlarson1 Mar 12, 2025
cdd6b33
Cleanup
jmlarson1 Mar 12, 2025
78c6d1f
Cleanup
jmlarson1 Mar 12, 2025
0060992
isort
jmlarson1 Mar 12, 2025
4e12bad
blacken-docs
jmlarson1 Mar 12, 2025
67dc2e8
Sim functions re-works
jmlarson1 Mar 12, 2025
9f28095
Sim functions re-works
jmlarson1 Mar 12, 2025
39cd732
Newer tagline as suggested by wildsm
jlnav Mar 12, 2025
9302d17
modify bebop-distributed example script to use pbs instead, presumabl…
jlnav Mar 12, 2025
7de8534
try removing overview of examples from left toctree, fix filenames fo…
jlnav Mar 12, 2025
c8ecc09
Merge branch 'develop' into docs/generator_section_refactor
jlnav Mar 13, 2025
fb8c609
Update submission script examples
shuds13 Mar 14, 2025
9bb1c4b
Add simple LSF script
shuds13 Mar 14, 2025
2f7001c
Mirror submission scripts to examples section
shuds13 Mar 14, 2025
2fbde00
Add example submit scripts perlmutter/frontier
shuds13 Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ updates:
submodule-updates:
patterns:
- "*"

7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
libEnsemble: A complete toolkit for dynamic ensembles of calculations
=====================================================================

Adaptive, portable, and scalable software for connecting "deciders" to experiments or simulations.
libEnsemble empowers model-driven ensembles to solve design, decision,
and inference problems on the world's leading supercomputers such as Frontier, Aurora, and Perlmutter.

• **Dynamic ensembles**: Generate parallel tasks on-the-fly based on previous computations.
• **Extreme portability and scaling**: Run on or across laptops, clusters, and leadership-class machines.
Expand All @@ -19,8 +20,6 @@ Adaptive, portable, and scalable software for connecting "deciders" to experimen
• **Data-flow between tasks**: Running ensemble members can send and receive data.
• **Low start-up cost**: No additional background services or processes required.

libEnsemble is effective at solving design, decision, and inference problems on parallel resources.

`Quickstart`_

Installation
Expand Down Expand Up @@ -97,7 +96,7 @@ Try some other examples live in Colab.
| Optimization example that finds multiple minima. | |Optimization example| |
+---------------------------------------------------------------+-------------------------------------+

There are many more examples in the `regression tests`_.
There are many more examples in the `Community Examples repository`_ and `regression tests`_.

Resources
=========
Expand Down
19 changes: 19 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Mock(MagicMock):
def __getattr__(cls, name):
return MagicMock()


autodoc_mock_imports = ["ax", "balsam", "gpcam", "IPython", "matplotlib", "pandas", "scipy", "surmise"]

MOCK_MODULES = [
Expand All @@ -42,11 +43,22 @@ def __getattr__(cls, name):
"PETSc",
"petsc4py",
"psutil",
"pyre_extensions",
"Tasmanian",
"torch",
]

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


class AxParameterWarning(Warning): # Ensure it's a real warning subclass
pass


# Fix only `AxParameterWarning` while keeping `ax` mocked
sys.modules["ax.exceptions.core"] = MagicMock()
sys.modules["ax.exceptions.core"].AxParameterWarning = AxParameterWarning

# from libensemble import *
# from libensemble.alloc_funcs import *
# from libensemble.gen_funcs import *
Expand All @@ -65,6 +77,7 @@ def __getattr__(cls, name):
sys.path.append(os.path.abspath("../libensemble/tools/live_data"))
sys.path.append(os.path.abspath("../libensemble/executors"))
sys.path.append(os.path.abspath("../libensemble/resources"))
sys.path.append(os.path.abspath("../libensemble/tests/scaling_tests/forces"))
# print(sys.path)

# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -216,8 +229,14 @@ def __getattr__(cls, name):
# html_static_path = []


def remove_noqa(app, what, name, obj, options, lines):
for i, line in enumerate(lines):
lines[i] = line.replace("# noqa", "")


def setup(app):
app.add_css_file("my_theme.css")
app.connect("autodoc-process-docstring", remove_noqa)


# Custom sidebar templates, must be a dictionary that maps document names
Expand Down
42 changes: 41 additions & 1 deletion docs/examples/alloc_funcs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ Allocation Functions

Below are example allocation functions available in libEnsemble.

Many users use these unmodified.

.. IMPORTANT::
See the API for allocation functions :ref:`here<api_alloc_f>`.

.. note::
The default allocation function is ``give_sim_work_first``.
The default allocation function (for non-persistent generators) is :ref:`give_sim_work_first<gswf_label>`.

The most commonly used (for persistent generators) is :ref:`start_only_persistent<start_only_persistent_label>`.

.. role:: underline
:class: underline
Expand Down Expand Up @@ -59,3 +63,39 @@ start_persistent_local_opt_gens
.. automodule:: start_persistent_local_opt_gens
:members:
:undoc-members:

fast_alloc_and_pausing
----------------------
.. automodule:: fast_alloc_and_pausing
:members:
:undoc-members:

only_one_gen_alloc
------------------
.. automodule:: only_one_gen_alloc
:members:
:undoc-members:

start_fd_persistent
-------------------
.. automodule:: start_fd_persistent
:members:
:undoc-members:

persistent_aposmm_alloc
-----------------------
.. automodule:: persistent_aposmm_alloc
:members:
:undoc-members:

give_pregenerated_work
----------------------
.. automodule:: give_pregenerated_work
:members:
:undoc-members:

inverse_bayes_allocf
--------------------
.. automodule:: inverse_bayes_allocf
:members:
:undoc-members:
44 changes: 24 additions & 20 deletions docs/examples/aposmm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ APOSMM
------

Asynchronously Parallel Optimization Solver for finding Multiple Minima
(APOSMM) coordinates concurrent local optimization runs in order to identify
many local minima.
(APOSMM) coordinates concurrent local optimization runs to identify
many local minima faster on parallel hardware.

Supported local optimization routines include:

- DFO-LS_ Derivative-free solver for (bound constrained) nonlinear least-squares minimization
- NLopt_ Library for nonlinear optimization, providing a common interface for various methods
- `scipy.optimize`_ Open-source solvers for nonlinear problems, linear programming,
constrained and nonlinear least-squares, root finding, and curve fitting.
- `PETSc/TAO`_ Routines for the scalable (parallel) solution of scientific applications

Required: mpmath_, SciPy_

Expand All @@ -12,32 +20,26 @@ Optional (see below): petsc4py_, nlopt_, DFO-LS_
Configuring APOSMM
^^^^^^^^^^^^^^^^^^

APOSMM works with a choice of optimizers, some requiring external packages. To
import the optimization packages (and their dependencies) at a global level
(recommended), add the following lines in the calling script before importing
APOSMM::
APOSMM works with a choice of optimizers, some requiring external packages. Specify
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are occasions where we cant do this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know of cases were we can't import the external local opt before APOSMM

Copy link
Member

@shuds13 shuds13 Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1064

If you import PETSc globally when running with openMPI (and using the executor) you have nested MPI (as PETSC imports MPI). So it must be imported in the function in those cases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a note to point to this issue with PETSc?

them on a global level before importing APOSMM::

import libensemble.gen_funcs
libensemble.gen_funcs.rc.aposmm_optimizers = <optimizers>

where ``optimizers`` is a string (or list of strings) from the available options:
where ``optimizers`` is a string (or list-of-strings) from:

``"petsc"``, ``"nlopt"``, ``"dfols"``, ``"scipy"``, ``"external"``

.. dropdown:: Issues with ensemble hanging or failed simulations?

Note that if using **mpi4py** comms, PETSc must be imported at the global
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed?

level or the ensemble may hang.
.. dropdown:: Issues with ensemble hanging or failed simulations with PETSc?

Exception: In the case that you are using the MPIExecutor or other MPI inside
a user function and you are using Open MPI, then you must:
If using the MPIExecutor or other MPI routines
and your MPI backend is Open MPI, then you must:

- Use ``local`` comms for libEnsemble (not ``mpi4py``)
- Must **NOT** include the *rc* line above
- Use ``local`` comms for libEnsemble (no ``mpirun``, ``mpiexec``, ``aprun``, etc.).
- Must **NOT** include the *aposmm_optimizers* line above.

This is because PETSc imports MPI, and a global import of PETSc would result
in nested MPI (which is not supported by Open MPI). When the above line is
not used, an import local to the optimization function will happen.
This is because PETSc imports MPI, and a global import of PETSc results
in nested MPI (which is not supported by Open MPI).

To see the optimization algorithms supported, see `LocalOptInterfacer`_.

Expand All @@ -49,17 +51,19 @@ Persistent APOSMM
^^^^^^^^^^^^^^^^^

.. automodule:: persistent_aposmm
:members:
:members: aposmm
:undoc-members:

LocalOptInterfacer
^^^^^^^^^^^^^^^^^^
.. automodule:: aposmm_localopt_support
:members:
:members: LocalOptInterfacer
:undoc-members:

.. _DFO-LS: https://github.com/numericalalgorithmsgroup/dfols
.. _mpmath: https://pypi.org/project/mpmath
.. _nlopt: https://nlopt.readthedocs.io/en/latest/
.. _petsc4py: https://bitbucket.org/petsc/petsc4py
.. _SciPy: https://pypi.org/project/scipy
.. _PETSc/TAO: http://www.mcs.anl.gov/petsc
.. _scipy.optimize: https://docs.scipy.org/doc/scipy/reference/optimize.html
10 changes: 6 additions & 4 deletions docs/examples/ax_multitask.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
persistent_ax_multitask
-----------------------

Required: Ax_ version <=0.4.0
Required: `ax-platform`_>=0.5.0

Example usage: gp_multitask_ax_

To install::

pip install "ax-platform<=0.4.0"
pip install ax-platform

An example of the Ax multitask GP.

.. automodule:: persistent_ax_multitask
:members:
:no-undoc-members:

.. _Ax: https://github.com/facebook/Ax
.. _`ax-platform`: https://github.com/facebook/Ax
.. _gp_multitask_ax: https://github.com/Libensemble/libensemble/blob/main/libensemble/tests/regression_tests/test_persistent_gp_multitask_ax.py
17 changes: 11 additions & 6 deletions docs/examples/calling_scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@ Electrostatic Forces with Executor

These examples are from a test for evaluating the scaling capabilities of libEnsemble
by calculating particle electrostatic forces through a user application. This
application is registered with either the MPI or Balsam Executor, then submitted
for execution in the ``sim_f``. Note the use of the ``parse_args()`` and
``save_libE_output()`` convenience functions from the :doc:`tools<../utilities>` module
in the first calling script.
application is registered with the MPIExecutor, then submitted
for execution in the ``sim_f``. Note the use of the ``parse_args=True`` which allows
reading arguments such as the number of workers from the command line.

Traditional Version
~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../../libensemble/tests/scaling_tests/forces/forces_adv/run_libe_forces.py
Run using five workers with::

python run_libe_forces.py -n 5

One worker runs a persistent generator and the other four run the forces simulations.

.. literalinclude:: ../../libensemble/tests/scaling_tests/forces/forces_simple/run_libe_forces.py
:language: python
:caption: tests/scaling_tests/forces/forces_adv/run_libe_forces.py
:caption: tests/scaling_tests/forces/forces_simple/run_libe_forces.py
:linenos:

Object + yaml Version
Expand Down
8 changes: 3 additions & 5 deletions docs/examples/examples_index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Example User Functions and Calling Scripts
==========================================
Overview of Examples
====================

Here we give example generation, simulation, and allocation functions for
libEnsemble, as well as example calling scripts.

Additional examples from libEnsemble's users are available in
the `libEnsemble Community Repository`_, with corresponding generator documentation available
:doc:`here<community:index>`.
The examples come from the libEnsemble repository and the `libEnsemble Community Repository`_.

.. toctree::
:maxdepth: 2
Expand Down
Loading
Loading