Skip to content

Commit 59a2901

Browse files
authored
Merge branch 'main' into ParSNSTOP
2 parents e4fd7b1 + 9d417c7 commit 59a2901

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+390
-1936
lines changed

.github/build_real.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,11 @@ if [[ $IMAGE == "private" ]]; then
77
cp -r $HOME/SNOPT/* pyoptsparse/pySNOPT/source
88
fi
99

10+
# temporarily disable pip constraints file for build-time dependencies
11+
mv ~/.config/pip/constraints.txt ~/.config/pip/constraints.txt.bkup
12+
touch ~/.config/pip/constraints.txt
13+
1014
pip install .[optview,testing] -v
15+
16+
# move pip constraints file back
17+
mv ~/.config/pip/constraints.txt.bkup ~/.config/pip/constraints.txt

.github/environment.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
dependencies:
22
# build
33
- python >=3.9
4-
- numpy >=1.21,<2
5-
- ipopt
4+
- numpy >=2.0
65
- swig
76
- meson >=1.3.2
87
- compilers
98
- pkg-config
109
- pip
1110
- setuptools
1211
- build
12+
- flang 5*
13+
- libpgmath
14+
# runtime
1315
- packaging
16+
- mdolab-baseclasses >=1.3.1
17+
- scipy >=1.7
18+
- sqlitedict >=1.6
19+
- cyipopt
1420
# testing
1521
- parameterized
1622
- testflo
17-
- scipy >=1.7
18-
- mdolab-baseclasses >=1.3.1
19-
- sqlitedict >=1.6

.github/test_real.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ cd tests
1111
# we have to copy over the coveragerc file to make sure it's in the
1212
# same directory where codecov is run
1313
cp ../.coveragerc .
14-
testflo --pre_announce --disallow_deprecations -v --coverage --coverpkg pyoptsparse $EXTRA_FLAGS --timeout 60
14+
15+
testflo -i --pre_announce --disallow_deprecations -v --coverage --coverpkg pyoptsparse $EXTRA_FLAGS --timeout 60

.github/windows.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
displayName: Install mamba and update environment
2828
2929
- script: |
30-
set IPOPT_DIR=%CONDA_PREFIX%\Library
3130
set CC=cl
3231
set FC=flang
3332
set CC_LD=link

.github/workflows/linux-build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PyOptSparse Linux Actions
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-linux:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 15
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
versions: [{python: "3.10", numpy: "1.22"}, {python: "3.11", numpy: "1.25"}, {python: "3.12", numpy: "2.1"}]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.versions.python }}
24+
- name: Install runtime numpy ${{ matrix.versions.numpy }}
25+
run: |
26+
pip install -U pip wheel
27+
pip install numpy~=${{ matrix.versions.numpy }}
28+
- name: Build and install pyoptsparse
29+
run: |
30+
pip install .['testing']
31+
- name: Run tests
32+
run: |
33+
cd tests
34+
testflo -i --pre_announce -v -n 1 .

.github/workflows/windows-build.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,45 @@ on:
1111
jobs:
1212
build-windows:
1313
runs-on: windows-latest
14-
14+
timeout-minutes: 15
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
numpy_version: ["1.21.6", "1.25.2", "2.1.3"]
1519
steps:
16-
- uses: actions/checkout@v2
17-
- uses: conda-incubator/setup-miniconda@v2
20+
- uses: actions/checkout@v4
21+
- uses: conda-incubator/setup-miniconda@v3
1822
with:
19-
python-version: 3.9
20-
miniforge-variant: Mambaforge
23+
python-version: "3.10"
2124
channels: conda-forge,defaults
2225
channel-priority: strict
2326
activate-environment: pyos-build
2427
environment-file: .github/environment.yml
25-
- name: Install libpgmath
26-
shell: bash -l {0}
27-
run: |
28-
conda activate pyos-build
29-
mamba install libpgmath
3028
- name: Build and install pyoptsparse
3129
shell: cmd /C CALL {0}
3230
run: |
3331
call conda activate pyos-build
34-
set IPOPT_DIR=%CONDA_PREFIX%\Library
35-
set CC=cl
36-
set FC=flang
37-
set CC_LD=link
32+
33+
:: debug - list conda environment
34+
call conda list
35+
36+
:: debug - list environment vars
37+
set
38+
39+
:: set fortran compiler, flang 5 activation doesn't seem to do it
40+
set FC=flang.exe
41+
3842
python -m build -n -x .
43+
3944
pip install --no-deps --no-index --find-links dist pyoptsparse
45+
- name: Install runtime numpy ${{ matrix.numpy_version }}
46+
shell: bash -l {0}
47+
run: |
48+
conda activate pyos-build
49+
conda install numpy==${{ matrix.numpy_version }}
4050
- name: Run tests
4151
shell: bash -l {0}
4252
run: |
4353
conda activate pyos-build
4454
cd tests
45-
testflo --pre_announce -v -n 1 --timeout 60 .
55+
testflo -i --pre_announce -v -n 1 --timeout 60 .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ALPSO, CONMIN, IPOPT, NLPQLP, NSGA2, PSQP, SLSQP, ParOpt and SNOPT are currently
2323

2424
We do not provide the source code for SNOPT and NLPQLP, due to their restrictive license requirements.
2525
Please contact the authors of the respective optimizers if you wish to obtain them.
26-
Furthermore, ParOpt and IPOPT are available as a open source package but must be installed separately.
26+
Furthermore, ParOpt and IPOPT are available as open source packages but must be installed separately.
2727
Please see the documentation page of each optimizer for purchase and installation instructions.
2828

2929
## Integration into other frameworks

doc/install.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pyOptSparse has the following dependencies:
3434
We recommend ``gcc`` and ``gfortran`` which can be installed via the package manager for your operating system.
3535

3636
Please make sure these are installed and available for use.
37-
In order to use NSGA2, SWIG (v1.3+) is also required, which can be installed via the package manager.
3837
Python dependencies are automatically handled by ``pip``, so they do not need to be installed separately.
3938

4039
.. note::
@@ -68,6 +67,12 @@ If you plan to modify pyOptSparse, installing with the developer option, i.e. wi
6867
Some optimizers are proprietary, and their sources are not distributed with pyOptSparse.
6968
To use them, please follow the instructions on specific optimizer pages.
7069

70+
To see the list of installed optimizers, use the following:
71+
72+
.. prompt:: bash
73+
74+
python -c "import pyoptsparse; print(pyoptsparse.list_optimizers())"
75+
7176
Specifying compilers
7277
~~~~~~~~~~~~~~~~~~~~
7378
To specify a non-default compiler (e.g. something other than ``/usr/bin/gcc``), meson recognizes certain `special environment variables <https://mesonbuild.com/Reference-tables.html#compiler-and-linker-selection-variables>`__.
@@ -184,19 +189,6 @@ An ``environment.yml`` file is provided in the ``pyoptsparse`` repo:
184189
conda config --env --set channel_priority strict
185190

186191
conda env update -f .github\environment.yml
187-
conda install libpgmath
188-
189-
Next, we need to tell the compiler where to find IPOPT:
190-
191-
.. tabs::
192-
193-
.. code-tab:: bash Linux/OSX
194-
195-
export IPOPT_DIR="$CONDA_PREFIX"
196-
197-
.. code-tab:: powershell Windows
198-
199-
set IPOPT_DIR=%CONDA_PREFIX%\Library
200192

201193
Finally, build the wheel and install it using pip:
202194

doc/optimizers/IPOPT.rst

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,14 @@ IPOPT
44
=====
55
IPOPT (Interior Point OPTimizer) is an open source interior point optimizer, designed for large-scale nonlinear optimization.
66
The source code can be found `here <https://www.coin-or.org/download/source/Ipopt/>`_.
7-
The latest version we support is 3.13.2.
7+
The latest version we support is 3.14.17.
88

99
Installation
1010
------------
11-
IPOPT must be installed separately, then linked to pyOptSparse when building.
12-
For the full installation instructions, please see `their documentation <https://coin-or.github.io/Ipopt/INSTALL.html>`_.
13-
OpenMDAO also has a very helpful `script <https://github.com/OpenMDAO/build_pyoptsparse/>`_ which can be used to install IPOPT with other linear solvers.
14-
Here we explain a basic setup using MUMPS as the linear solver, together with METIS adapted from the OpenMDAO script.
15-
16-
#. Download the tarball and extract it to ``$IPOPT_DIR`` which could be set to for example ``$HOME/packages/Ipopt``.
17-
18-
#. Install METIS, which can be used to improve the performance of the MUMPS linear solver.
19-
20-
.. code-block:: bash
21-
22-
# build METIS
23-
cd $IPOPT_DIR
24-
git clone https://github.com/coin-or-tools/ThirdParty-Metis.git
25-
cd ThirdParty-Metis
26-
./get.Metis
27-
./configure --prefix=$IPOPT_DIR
28-
make
29-
make install
30-
31-
#. Install MUMPS
32-
33-
.. code-block:: bash
34-
35-
# build MUMPS
36-
cd $IPOPT_DIR
37-
git clone https://github.com/coin-or-tools/ThirdParty-Mumps.git
38-
cd ThirdParty-Mumps
39-
./get.Mumps
40-
./configure --with-metis --with-metis-lflags="-L${IPOPT_DIR}/lib -lcoinmetis" \
41-
--with-metis-cflags="-I${IPOPT_DIR}/include -I${IPOPT_DIR}/include/coin-or -I${IPOPT_DIR}/include/coin-or/metis" \
42-
--prefix=$IPOPT_DIR CFLAGS="-I${IPOPT_DIR}/include -I${IPOPT_DIR}/include/coin-or -I${IPOPT_DIR}/include/coin-or/metis" \
43-
FCFLAGS="-I${IPOPT_DIR}/include -I${IPOPT_DIR}/include/coin-or -I${IPOPT_DIR}/include/coin-or/metis"
44-
make
45-
make install
46-
47-
#. Build IPOPT
48-
49-
.. code-block:: bash
50-
51-
# build IPOPT
52-
cd $IPOPT_DIR
53-
mkdir build
54-
cd build
55-
../configure --prefix=${IPOPT_DIR} --disable-java --with-mumps --with-mumps-lflags="-L${IPOPT_DIR}/lib -lcoinmumps" \
56-
--with-mumps-cflags="-I${IPOPT_DIR}/include/coin-or/mumps"
57-
make
58-
make install
59-
60-
#. You must add the IPOPT library path to the ``LD_LIBRARY_PATH`` variable for things to work right.
61-
This could be done for example by adding the following to your ``.bashrc``:
62-
63-
.. code-block:: bash
64-
65-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPT_DIR/lib
66-
67-
Furthermore, the environment variable ``$IPOPT_DIR`` must be set correctly in order to link to pyOptSparse.
68-
Alternatively, you can manually define the variables ``$IPOPT_LIB`` and ``$IPOPT_INC`` for the lib and include paths separately.
69-
70-
71-
#. Now clean build pyOptSparse. Verify that IPOPT works by running the relevant tests.
11+
IPOPT and its Python interface `cyipopt <https://github.com/mechmotum/cyipopt>` must be installed separately.
12+
Follow the instructions `here <https://cyipopt.readthedocs.io/en/stable/install.html>`_.
13+
OpenMDAO also has a very helpful `script <https://github.com/OpenMDAO/build_pyoptsparse/>`_ which can be used to install IPOPT with other linear solvers,
14+
but it does not install ``cyipopt`` for you.
7215

7316
Options
7417
-------

meson_options.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
option('ipopt_dir', type: 'string', value: '',
2-
description: 'Top-level dir for ipopt')
3-
41
option('incdir_numpy', type: 'string', value: '',
52
description: 'Include directory for numpy. If left empty Meson will try to find it on its own.')
63

0 commit comments

Comments
 (0)