Skip to content

Commit 334565e

Browse files
committed
additional clarifying and infrastructure details as suggestd by gemini and claude
1 parent 8cbab2c commit 334565e

File tree

1 file changed

+49
-27
lines changed

1 file changed

+49
-27
lines changed

AGENTS.md

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,70 @@ Agent Contributor Guidelines and Information
33

44
Read the ``README.rst`` for an overview of libEnsemble.
55

6+
- libEnsemble uses a manager-worker architecture. Points are generated by a generator and sent to a worker, which runs a simulator.
7+
- The manager determines how and when points get passed to workers via an allocation function.
8+
69
Repository Layout
710
-----------------
811

9-
- ``libensemble/`` - source code.
10-
- ``/alloc_funcs`` - allocation functions. Policies for passing work between the manager and workers.
11-
- ``/comms`` - modules and abstractions for communication between the manager and workers.
12-
- ``/executors`` - an interface for launching executables, often simulations.
13-
- ``/gen_classes`` - generators that adhere to the `gest-api` standard.
12+
- ``libensemble/`` - Source code.
13+
- ``/alloc_funcs`` - Allocation functions. Policies for passing work between the manager and workers.
14+
- ``/comms`` - Modules and abstractions for communication between the manager and workers.
15+
- ``/executors`` - An interface for launching executables, often simulations.
16+
- ``/gen_classes`` - Generators that adhere to the `gest-api` standard.
1417
Recommended over entries from ``/gen_funcs`` that perform similar functionality.
15-
- ``/gen_funcs`` - generator functions. Modules for producing points for simulations.
16-
- ``/resources`` - classes and functions for managing compute resources for MPI tasks, libensemble workers.
17-
- ``/sim_funcs`` - simulator functions. Modules for running simulations or performing experiments.
18-
- ``/tests`` - tests.
19-
- ``/functionality_tests`` primarily tests libEnsemble code only.
20-
- ``/regression_tests`` tests libEnsemble code with external code. Often more closely resembles actual use-cases.
21-
- ``/unit_tests`` tests for individual modules.
22-
- ``/tools`` - tools. misc functions and classes to ease development.
23-
- ``/utils`` - utilities. misc functions and classes used internally by multiple modules.
18+
- ``/gen_funcs`` - Generator functions. Modules for producing points for simulations.
19+
- ``/resources`` - Classes and functions for managing compute resources for MPI tasks, libensemble workers.
20+
- ``/sim_funcs`` - Simulator functions. Modules for running simulations or performing experiments.
21+
- ``/tests`` - Tests.
22+
- ``/functionality_tests`` - Primarily tests libEnsemble code only.
23+
- ``/regression_tests`` - Tests libEnsemble code with external code. Often more closely resembles actual use-cases.
24+
- ``/unit_tests`` - Tests for individual modules.
25+
- ``/tools`` - Tools. Misc functions and classes to ease development.
26+
- ``/utils`` - Utilities. Misc functions and classes used internally by multiple modules.
2427
- ``ensemble.py`` - The primary interface for parameterizing and running libEnsemble.
25-
- ``generators.py`` - base classes for generators that adhere to the `gest-api` standard.
26-
- ``history.py`` - module for recording points that have been generated and simulation results. NumPy array.
28+
- ``generators.py`` - Base classes for generators that adhere to the `gest-api` standard.
29+
- ``history.py`` - Module for recording points that have been generated and simulation results. NumPy array.
2730
- ``libE.py`` - libE main file. Previous primary interface for parameterizing and running libEnsemble.
28-
- ``logger.py`` - logging configuration
29-
- ``manager.py`` - module for maintaining the history array and passing points between the workers.
30-
- ``message_numbers.py`` - constants that represent states of the ensemble.
31-
- ``specs.py`` - Dataclasses for parameterizing the ensemble.
32-
- ``worker.py`` - module for running generators and simulators. Communicates with the manager.
33-
- ``version.py`` - version file.
31+
- ``logger.py`` - Logging configuration
32+
- ``manager.py`` - Module for maintaining the history array and passing points between the workers.
33+
- ``message_numbers.py`` - Constants that represent states of the ensemble.
34+
- ``specs.py`` - Dataclasses for parameterizing the ensemble. Most importantly, contains ``LibeSpecs, SimSpecs, GenSpecs``.
35+
- ``worker.py`` - Module for running generators and simulators. Communicates with the manager.
36+
- ``version.py`` - Version file.
3437

3538
- ``.github/`` - GitHub actions. See ``.github/workflows/`` for the CI.
36-
- ``.docs/`` - Documentation. Check here first for information before reading the source code.
37-
- ``examples/`` - Symlinks to examples further inside the ``libensemble/`` directory.
39+
- ``docs/`` - Documentation. Check here first for information before reading the source code.
40+
- ``examples/`` - The ``*_funcs`` and ``calling_scripts`` directories contain symlinks to examples further in the source code.
41+
- ``/libE_submission_scripts`` - Example scripts for submitting libEnsemble jobs to HPC systems.
42+
- ``/tutorials`` - Tutorials on how to use libEnsemble.
43+
- ``pyproject.toml`` - Project configuration file. Contains information about the project and its dependencies.
3844

3945
Other files in the root directory should be self-documenting.
4046

4147
Familiarize yourself with ``libensemble/tests/regression_tests/test_1d_sampling.py`` for a simple example of the libEnsemble interface.
4248

49+
Information about Generators
50+
----------------------------
51+
52+
- Generators are functions or objects that produce points for simulations.
53+
- The History array is a numpy structured array that stores points that have been generated and simulation results. Its fields match ``sim_specs/gen_specs["out"]`` or ``vocs`` attributes.
54+
- Prior to libEnsemble v1.6.0, generators were plain functions. They often ran in "persistent" mode, meaning they executed in a long-running loop, sending and receiving points to and from the manager until the ensemble was complete.
55+
- A ``gest-api`` or "standardized" generator is a class that at a minimum implements ``suggest`` and ``ingest`` methods, and is parameterized by a ``vocs``.
56+
- See ``libensemble/generators.py`` for more information about the ``gest-api`` standard.
57+
4358
General Guidelines
4459
------------------
4560

46-
- If using a generator that adheres to the `gest-api` standard, use the ``start_only_persistent`` allocation function.
61+
- If using classic ``sim_specs`` and ``gen_specs``, then ensure that ``sim_specs["out"]`` and ``gen_specs["in"]`` field names match, and vice-versa.
62+
- As-of libEnsemble v1.6.0, ``SimSpecs`` and ``GenSpecs`` can also be parameterized by a ``vocs`` object, imported from ``gest_api.vocs`` (NOT xopt.vocs).
63+
- ``VOCS`` contains variables, objectives, constraints, and other settings that define the problem. See ``libensemble/tests/regression_tests/test_xopt_EI.py`` for an example of how to use it.
64+
- If using a generator that adheres to the ``gest-api`` standard, or a classic persistent generator, use the ``start_only_persistent`` allocation function.
4765
- An MPI distribution is not required for libEnsemble to run, but is required to use the ``MPIExecutor``. ``mpich`` is recommended.
4866
- New tests are heavily encouraged for new features, bug fixes, or integrations. See ``libensemble/tests/regression_tests`` for examples.
4967
- Never use destructive git commands unless explicitly requested.
5068
- Code is in the ``black`` style. This should be enforced by ``pre-commit``.
69+
- When writing new code, prefer the ``LibeSpecs``, ``SimSpecs``, and ``GenSpecs`` dataclasses over the classic ``sim_specs`` and ``gen_specs`` bare dictionaries.
5170
- Read ``CONTRIBUTING.md`` for more information.
5271

5372
Development Environment
@@ -57,6 +76,7 @@ Development Environment
5776
of dependencies and the available testing environments.
5877

5978
- Enter the development environment with ``pixi shell -e dev``. This environment contains the most common dependencies for development and testing.
79+
- For one-off commands, use ``pixi run -e dev``. This will run a single command in the development environment.
6080

6181
- If ``pixi`` is not available or not preferred by the user, ``pip`` can be used instead, but the user will need to manually install other dependencies.
6282

@@ -66,9 +86,11 @@ the configuration and ``pyproject.toml`` for other configuration.
6686
Testing
6787
-------
6888

69-
- Run tests with the ``run-tests.py`` script. See ``libensemble/tests/run-tests.py`` for usage information.
89+
- Run tests with the ``run-tests.py`` script: ``python libensemble/tests/run-tests.py``. See ``libensemble/tests/run-tests.py`` for usage information.
7090

7191
- Some tests require third party software to be installed. When developing a feature or fixing a bug the entire test suite may not necessarily need to be run,
7292
since it will be on Github Actions.
7393

74-
- Individual unit tests can be run with ``pytest``.
94+
- Individual unit tests can be run with ``pixi run -e dev pytest path/to/test_file``.
95+
- A libEnsemble run typically outputs an ``ensemble.log`` and ``libE_stats.txt`` file in the working directory. Check these files for tracebacks or run statistics.
96+
- An "ensemble" or "workflow" directory may also be created, often containing per-simulation output directories

0 commit comments

Comments
 (0)