Metadata-Version: 2.4
Name: mpi-sppy
Version: 0.14.0
Summary: mpi-sppy
Home-page: https://github.com/Pyomo/mpi-sppy
Author: David Woodruff
Author-email: David Woodruff <dlwoodruff@ucdavis.edu>
License: License
        =======
        
        BSD 3-Clause License
        
        Copyright (c) 2024, Lawrence Livermore National Security, LLC, Alliance for
        Sustainable Energy, LLC, The Regents of the University of California, et al.
        
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        * Redistributions of source code must retain the above copyright notice, this
          list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright notice,
          this list of conditions and the following disclaimer in the documentation
          and/or other materials provided with the distribution.
        
        * Neither the name of the copyright holder nor the names of its
          contributors may be used to endorse or promote products derived from
          this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: homepage, https://github.com/Pyomo/mpi-sppy
Project-URL: source, https://github.com/Pyomo/mpi-sppy
Project-URL: download, https://github.com/Pyomo/mpi-sppy
Project-URL: documentation, https://mpi-sppy.readthedocs.io
Project-URL: tracker, https://github.com/Pyomo/mpi-sppy/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy
Requires-Dist: sortedcollections
Requires-Dist: pyomo>=6.4
Provides-Extra: doc
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: sphinx-copybutton; extra == "doc"
Requires-Dist: sphinx_rtd_theme; extra == "doc"
Provides-Extra: mpi
Requires-Dist: mpi4py>=3.0.3; extra == "mpi"
Provides-Extra: scipy
Requires-Dist: scipy; extra == "scipy"
Provides-Extra: pandas
Requires-Dist: pandas; extra == "pandas"
Provides-Extra: plot
Requires-Dist: matplotlib; extra == "plot"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

mpi-sppy
========

Optimization under uncertainty for [Pyomo](https://pyomo.org) and other models.

[Documentation is available at readthedocs](https://mpi-sppy.readthedocs.io/en/latest/) and
there is a [paper](https://link.springer.com/article/10.1007/s12532-023-00247-3).

Status for internal tests
-------------------------

[![pyo tracker](https://github.com/Pyomo/mpi-sppy/actions/workflows/pyotracker.yml/badge.svg)](https://github.com/Pyomo/mpi-sppy/actions/workflows/pyotracker.yml)

MPI
---

A recent version of MPI and a compatible version of mpi4py are needed.

Here are two methods that seem to work well for installation, at least when considering non-HPC platforms.

1. Install OpenMPI and mpi4py using conda. Keep the order.
    ```
    conda install openmpi
    conda install mpi4py
    ```
2. If you already have an existing version of MPI, it may be better compile mpi4py against it.
   This can be done by installing mpi4py though pip.
   ```
   pip install mpi4py
   ```
3. It is also possible to automate mpi4py installation through pip as an optional dependency when
   installing mpi-sppy from pip or from source by adding the `[mpi]` extras flag.
   ```shell
   pip install -e .[mpi]
   ```
   Run the line aborve after cloning and moving to the repo root directory.

To test your installation, cd to the directory where you installed mpi-sppy
(it is called ``mpi-sppy``) and then give this command.

```
mpirun -n 2 python -m mpi4py mpi_one_sided_test.py
```

If you don't see any error messages, you might have an MPI
installation that will work well. Note that even if there is
an error message, mpi-sppy may still execute and return correct
results. Per the comment below, the run-times may just be 
unnecessarily inflated.

Installing mpi-sppy
-------------------

It is possible to pip install mpi-sppy; however, most users are better off
getting the software from Github because it is under active development.

Citing mpi-sppy
---------------
If you find mpi-sppy useful in your work, we kindly request that you cite the following
[paper](https://link.springer.com/article/10.1007/s12532-023-00247-3):

```
 @article{mpi-sppy,
   title={A Parallel Hub-and-Spoke System for Large-Scale Scenario-Based Optimization Under Uncertainty},
   author={Bernard Knueven and David Mildebrath and Christopher Muir and John D Siirola and Jean-Paul Watson and David L Woodruff},
   journal = {Math. Prog. Comp.},
   volume = {15}, 
   pages = {591-–619},
   year={2023}
 }
```

AN IMPORTANT NOTE FOR MPICH USERS ON HPC PLATFORMS
--------------------------------------------------

At least on some US Department of Energy (e.g., at Lawrence Livermore
National Laboratory) compute clusters, users of mpi-sppy that are
using an MPICH implementation of MPI may need to set the following in
order for both (1) proper execution of the one-sided test referenced
above and (2) rapid results when running any of the algorithms shipped
with mpi-sppy:

```
export MPICH_ASYNC_PROGRESS=1
```

Without this setting, we have observed run-times increase by a factor
of between 2 and 4, due to non-blocking point-to-point calls
apparently being treated as blocking.

Further, without this setting and in situations with a large number of
ranks (e.g., >> 10), we have observed mpi-sppy stalling once scenario
instances are created.

2026 NOTICE: per-spoke solver-options now overlay the global dict
-----------------------------------------------------------------

The per-spoke solver-options flags (``--lagrangian-solver-options``,
``--reduced-costs-solver-options``, etc.) now **overlay** the
global ``--solver-options`` dict for that spoke instead of
**replacing** it. The spoke flag's keys win on the keys it names;
the global flag's other keys survive. Previously the spoke flag
wiped the global dict for that spoke.

In the unlikely event you relied on the spoke flag dropping a
global key, re-spell every key you want in the spoke options or
omit the global flag.
See the ``solver-options`` section of the generic_cylinders docs
for the worked example.

2022 NOTICE
-----------

There was a disruptive change on August 11, 2022 concerning how
options are accessed. See the file ``disruptions.txt`` for more
information. If you are a new user, this will not affect you,
regardless of how you install. If you are an
existing user, you should consider the disruption before updating to
the latest mpi-sppy. The documentation on readthedocs
probably refers to the newest version.

