Skip to content

Commit

Permalink
Merge pull request #160 from WISDEM/use_conda_pyoptsparse
Browse files Browse the repository at this point in the history
Use conda from pyoptsparse instead of custom compile
  • Loading branch information
gbarter authored Jan 21, 2022
2 parents 336ee52 + c28506a commit c2aa02b
Show file tree
Hide file tree
Showing 354 changed files with 53 additions and 104,649 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ The installation instructions below use the environment name, "weis-env," but an

2. Use conda to install the build dependencies. Note the differences between Windows and Mac/Linux build systems. Skip to point #3 if you are on the DOE HPC system Eagle

conda install -y cmake cython control dill git jsonschema make matplotlib-base numpy openmdao openpyxl pandas pip pytest python-benedict pyyaml ruamel_yaml scipy setuptools smt sortedcontainers swig
conda install -y cmake cython control dill git jsonschema make matplotlib-base numpy openmdao openpyxl pandas pip pyoptsparse pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy slycot smt sortedcontainers swig
conda install -y petsc4py mpi4py # (Mac / Linux only)
conda install -y compilers # (Mac only)
conda install -y m2w64-toolchain libpython # (Windows only)
pip install simpy marmot-agents jsonmerge fatpack
pip install marmot-agents jsonmerge fatpack
git clone https://github.com/WISDEM/WEIS.git
cd WEIS
git checkout branch_name # (Only if you want to switch git branch, say develop)
python setup.py develop

3. Instructions specific for DOE HPC system Eagle

conda install -y cmake cython control dill git jsonschema make matplotlib-base numpy openmdao openpyxl pandas pip pytest python-benedict pyyaml ruamel_yaml scipy setuptools smt sortedcontainers swig
conda install -y petsc4py mpi4py
pip install simpy marmot-agents jsonmerge fatpack
conda install -y cmake cython control dill git jsonschema make matplotlib-base numpy openmdao openpyxl pandas pip pyoptsparse pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy slycot smt sortedcontainers swig
conda install -y petsc4py mpi4py
pip install marmot-agents jsonmerge fatpack
git clone https://github.com/WISDEM/WEIS.git
cd WEIS
git checkout branch_name # (Only if you want to switch git branch, say develop)
Expand Down
20 changes: 17 additions & 3 deletions WISDEM/.github/workflows/CI_WISDEM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
#shell: pwsh # putting in a shell command makes for compile linking problems later
# (if you use the shell here, cannot use 'compiler' package)
run: |
conda install -y petsc4py mpi4py compilers nlopt
conda install -y petsc4py mpi4py compilers pyoptsparse
# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
Expand All @@ -44,12 +44,26 @@ jobs:
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

# Install WISDEM
- name: Install WISDEM
# Install WISDEM with setup
- name: Install WISDEM with setup
shell: pwsh
run: |
python setup.py develop
# Install WISDEM with pip
- name: Install WISDEM with pip for Unix
if: false == contains( matrix.os, 'windows')
shell: pwsh
run: |
pip install -vv --no-deps -e .
# Install WISDEM with pip
#- name: Install WISDEM with pip for Windows
# if: contains( matrix.os, 'windows')
# shell: pwsh
# run: |
# pip install -vv --no-deps --global-option --compiler=unix .

# Run all tests
- name: Run tests
if: contains( matrix.os, 'ubuntu')
Expand Down
16 changes: 5 additions & 11 deletions WISDEM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,19 @@ The installation instructions below use the environment name, "wisdem-env," but
conda create -y --name wisdem-env python=3.8
conda activate wisdem-env

2. In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM as a conda package to easily satisfy all dependencies, but then removing the WISDEM conda package and reinstalling from the Github source code. Note the differences between Windows and Mac/Linux build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite).
2. In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer / editable* mode using the instructions here. If you really just want to use WISDEM as a library and lean on the documentation, you can always do `conda install wisdem` and be done. Note the differences between Windows and Mac/Linux build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite).

conda install -y wisdem git
conda remove -y --force wisdem
conda install -y compilers # (Mac only)
conda install -y cython git jsonschema make matplotlib nlopt numpy openmdao openpyxl pandas pip pyside2 pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy sortedcontainers swig
conda install -y pyoptsparse # (Linux only)
conda install -y compilers pyoptsparse # (Mac only)
conda install -y m2w64-toolchain libpython # (Windows only)
pip install simpy marmot-agents nlopt
pip install marmot-agents
git clone https://github.com/WISDEM/WISDEM.git
cd WISDEM
git checkout develop # If you want to switch WISDEM branches
python setup.py develop


3. OPTIONAL: Install pyOptSparse, a package that provides a handful of additional optimization solvers and has OpenMDAO support:

git clone https://github.com/evan-gaertner/pyoptsparse.git
pip install -e pyoptsparse


**NOTE:** To use WISDEM again after installation is complete, you will always need to activate the conda environment first with `conda activate wisdem-env`


Expand Down
27 changes: 11 additions & 16 deletions WISDEM/docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,32 @@ Setup and activate the Anaconda environment from a prompt (Anaconda3 Power Shell
.. code-block:: bash
conda config --add channels conda-forge
conda create -y --name wisdem-env python=3.7
conda create -y --name wisdem-env python=3.8
conda activate wisdem-env
Note that any future occasion on which you wish to use WISDEM, you will only have to start with ``conda activate wisdem-env``.

Install WISDEM
^^^^^^^^^^^^^^

In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM as a conda package to easily satisfy all dependencies, but then removing the WISDEM conda package and reinstalling from the Github source code. Note the differences between Windows and Mac build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite).
In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM dependencies and then installing WISDEM from the Github source code. Note the differences between Windows and Mac build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite).

.. code-block:: bash
conda install -y wisdem git
conda remove --force wisdem
pip install simpy marmot-agents nlopt
conda install -y cython git jsonschema make matplotlib nlopt numpy openmdao openpyxl pandas pip pyside2 pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy sortedcontainers swig
pip install marmot-agents
For Linux systems:

.. code-block:: bash
conda install pyoptsparse
For Mac systems:

.. code-block:: bash
conda install compilers
conda install compilers pyoptsparse
For Windows systems:

Expand All @@ -50,16 +55,6 @@ Finally, for all systems:
git checkout develop
pip install -e .
Install pyOptSparse (`Optional`)
""""""""""""""""""""""""""""""""

`pyOptSparse <https://github.com/mdolab/pyoptsparse>`_ is a package that provides additional optimization solvers with OpenMDAO support:

.. code-block:: bash
git clone https://github.com/evan-gaertner/pyoptsparse.git
pip install -e pyoptsparse
Run Unit Tests
^^^^^^^^^^^^^^

Expand Down
5 changes: 3 additions & 2 deletions WISDEM/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ dependencies:
- pyyaml
- ruamel_yaml
- scipy
- setuptools==58.4.0
- setuptools
- simpy
- sortedcontainers
- swig
- pip:
- simpy
- marmot-agents
# Needs to be done outside of environment file:
# - m2w64-toolchain # [win]
# - libpython # [win]
# - compilers # [not win]
# - petsc4py # [not win]
# - pyoptsparse # [not win]
5 changes: 2 additions & 3 deletions WISDEM/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
extra_compile_args=["-O2", "-fPIC", "-std=c11"],
)
pyframeExt = Extension(
"wisdem.pyframe3dd._pyframe3dd",
"wisdem.pyframe3dd._pyframe3dd",
sources=glob.glob(os.path.join("wisdem", "pyframe3dd", "src", "*.c")),
extra_compile_args=["-O2", "-fPIC", "-std=c11"],
)
Expand All @@ -29,7 +29,7 @@
# Top-level setup
setup(
name="WISDEM",
version="3.5.0",
version="3.5.1",
description="Wind-Plant Integrated System Design & Engineering Model",
long_description="""WISDEM is a Python package for conducting multidisciplinary analysis and
optimization of wind turbines and plants. It is built on top of NASA's OpenMDAO library.""",
Expand All @@ -43,7 +43,6 @@
"openmdao>=3.4",
"openpyxl",
"pandas",
"pyside2",
"pytest",
"python-benedict",
"pyyaml",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
from openmdao.utils.general_utils import run_driver
from openmdao.test_suite.components.sellar import SellarDerivatives, SellarDerivativesGrouped
from openmdao.test_suite.groups.sin_fitter import SineFitter
from wisdem.optimization_drivers.nlopt_driver import NLoptDriver
from openmdao.test_suite.components.paraboloid import Paraboloid
from openmdao.test_suite.components.simple_comps import NonSquareArrayComp
from openmdao.test_suite.components.expl_comp_array import TestExplCompArrayDense

from wisdem.optimization_drivers.nlopt_driver import NLoptDriver

try:
import nlopt
except ImportError:
Expand Down Expand Up @@ -1001,9 +1000,11 @@ def test_call_final_setup(self):
with self.assertRaises(RuntimeError) as cm:
totals = prob.check_totals(method="fd", out_stream=False)

expected_msg = "Problem: run_model must be called before total derivatives can be checked."
# expected_msg = "Problem: run_model must be called before total derivatives can be checked."
expected_msg = "run_model must be called before total derivatives can be checked."

self.assertEqual(expected_msg, str(cm.exception))
# self.assertEqual(expected_msg, str(cm.exception))
self.assertTrue(str(cm.exception).find(expected_msg) >= 0)

def test_LN_COBYLA_linear_constraint(self):
# Bug where NLoptDriver tried to compute and cache the constraint derivatives for the
Expand Down
4 changes: 3 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies:
- openpyxl
- pandas
- pip
- pyoptsparse
- pyside2
- pytest
- pytest-cov
Expand All @@ -28,6 +29,8 @@ dependencies:
- ruamel_yaml
- scipy
- setuptools
- simpy
- slycot
- smt
- sortedcontainers
- swig
Expand All @@ -36,7 +39,6 @@ dependencies:
- fatpack
- jsonmerge
- marmot-agents
- simpy
# Needs to be done outside of environment file:
# - m2w64-toolchain # [win]
# - libpython # [win]
Expand Down
16 changes: 0 additions & 16 deletions pyoptsparse/.coveragerc

This file was deleted.

40 changes: 0 additions & 40 deletions pyoptsparse/.github/ISSUE_TEMPLATE.md

This file was deleted.

24 changes: 0 additions & 24 deletions pyoptsparse/.github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

6 changes: 0 additions & 6 deletions pyoptsparse/.gitignore

This file was deleted.

Loading

0 comments on commit c2aa02b

Please sign in to comment.