Skip to content

Commit

Permalink
Merge pull request #264 from WISDEM/restore_win_tests
Browse files Browse the repository at this point in the history
WEIS now works on Windows
  • Loading branch information
gbarter authored Feb 6, 2024
2 parents e498e27 + 3cc7105 commit 1643ab7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 40 deletions.
25 changes: 4 additions & 21 deletions .github/workflows/CI_WEIS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macOS-latest"] #, "windows-latest"]
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.9","3.10","3.11"]

steps:
Expand All @@ -38,16 +38,11 @@ jobs:
environment-file: environment.yml
activate-environment: test
auto-activate-base: false

- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
run: |
conda install -y -c intel intel-openmp mkl

- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
run: |
conda install -y petsc4py mpi4py openmpi
conda install -y petsc4py mpi4py openmpi pyoptsparse
- name: Add test packages
run: |
Expand All @@ -61,24 +56,12 @@ jobs:
# Install WEIS
- name: Install WEIS
run: |
pip install -e .
pip install -e . -v
# Debugging session
#- name: Setup tmate session
# if: contains( matrix.os, 'windows')
# uses: mxschmitt/action-tmate@v3

#- name: Show openfast environment
# run: |
# which -a openfast
# cd /c/Miniconda3/envs/test/Library/bin/
# ls *fast*.exe
# ls *fast*.dll
# openfast -h
# python -c "import ctypes; ctypes.cdll.LoadLibrary('openfastlib.dll')"
# ls *fast*.dll
# cd examples/03_NREL5MW_OC3_spar
# python weis_driver.py

# List the collected tests for debugging purposes
- name: List tests
Expand All @@ -92,7 +75,7 @@ jobs:
# Run coveralls
- name: Run coveralls
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.10')
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.11')
uses: coverallsapp/github-action@v2
# This also works, https://github.com/AndreMiras/coveralls-python-action
#uses: AndreMiras/coveralls-python-action@develop
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The core WEIS modules are:

## Installation

On laptop and personal computers, installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis. WEIS requires [Anaconda 64-bit](https://www.anaconda.com/distribution/). However, the `conda` command has begun to show its age and we now recommend the one-for-one replacement with the [Miniforge3 distribution](https://github.com/conda-forge/miniforge?tab=readme-ov-file#miniforge3), which is much more lightweight and more easily solves for the package dependencies. Sometimes, using `mamba` in place of `conda` with this distribution speeds up the installation process. WEIS is currently supported on Linux, MAC and Windows Sub-system for Linux (WSL). Installing WEIS on native Windows is not yet supported, but planned in 2024.
On laptop and personal computers, installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis. WEIS requires [Anaconda 64-bit](https://www.anaconda.com/distribution/). However, the `conda` command has begun to show its age and we now recommend the one-for-one replacement with the [Miniforge3 distribution](https://github.com/conda-forge/miniforge?tab=readme-ov-file#miniforge3), which is much more lightweight and more easily solves for the package dependencies. WEIS is currently supported on Linux, Mac, and Windows (natively or with the Linux sub-system (WSL)).

The installation instructions below use the environment name, "weis-env," but any name is acceptable. For those working behind company firewalls, you may have to change the conda authentication with `conda config --set ssl_verify no`. Proxy servers can also be set with `conda config --set proxy_servers.http http://id:pw@address:port` and `conda config --set proxy_servers.https https://id:pw@address:port`.

Expand All @@ -44,12 +44,12 @@ The installation instructions below use the environment name, "weis-env," but an
module purge
module load conda

1. Setup and activate the Anaconda environment from a prompt (WSL terminal on Windows or Terminal.app on Mac)
1. Setup and activate the Anaconda environment from a command prompt:

conda config --add channels conda-forge
conda env create --name weis-env -f https://raw.githubusercontent.com/WISDEM/WEIS/develop/environment.yml
conda activate weis-env # (if this does not work, try source activate weis-env)
conda install -y petsc4py mpi4py # (Mac / Linux only)
conda install -y petsc4py mpi4py pyoptsparse # (Mac / Linux only)


2. Clone the repository and install the software
Expand All @@ -69,7 +69,7 @@ The installation instructions below use the environment name, "weis-env," but an

## Developer guide

If you plan to contribute code to WEIS, please first consult the [developer guide](https://weis.readthedocs.io/en/latest/how_to_contribute_code.html).
If you plan to contribute code to WEIS, please first consult the [developer guide](https://weis.readthedocs.io/en/latest/how_to_contribute_code.html). You are also likely to want to install some of the compiled WEIS dependencies (OpenFAST or WISDEM or pyHAMS or ROSCO) from a local copy instead of relying on the conda packages.

## Feedback

Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ dependencies:
- pyDOE3
- pygments
- pyhams
- pyoptsparse
- python-json-logger
- pyzmq
- qdldl-python
Expand Down
10 changes: 7 additions & 3 deletions weis/dtqpy/solver/DTQPy_SOLVER.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
Primary Contributor: Daniel R. Herber (danielrherber on Github)
"""
from weis.dtqpy.solver.DTQPy_SOLVER_osqp import DTQPy_SOLVER_osqp
from weis.dtqpy.solver.DTQPy_SOLVER_ipopt import DTQPy_SOLVER_ipopt
from weis.dtqpy.solver.DTQPy_SOLVER_slsqp import DTQPy_SOLVER_slsqp
PYOPT = True
try:
from weis.dtqpy.solver.DTQPy_SOLVER_ipopt import DTQPy_SOLVER_ipopt
from weis.dtqpy.solver.DTQPy_SOLVER_slsqp import DTQPy_SOLVER_slsqp
except Exception:
PYOPT = False

def DTQPy_SOLVER(H,f,A,b,Aeq,beq,lb,ub,internal,opts):


displevel = opts.general.displevel

# osqp
if opts.solver.function == 'osqp':
if opts.solver.function == 'osqp' or not PYOPT:
X,F,intrnal,opts = DTQPy_SOLVER_osqp(H,f,A,b,Aeq,beq,lb,ub,internal,opts)

elif opts.solver.function == 'ipopt':
Expand Down
12 changes: 7 additions & 5 deletions weis/dtqpy/solver/DTQPy_SOLVER_ipopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
Contributor: Athul Krishna Sundarrajan (AthulKrishnaSundarrajan on Github)
Primary Contributor: Daniel R. Herber (danielrherber on Github)
"""
# import pyoptsparse
from pyoptsparse import IPOPT, Optimization

from scipy import sparse


import argparse

import numpy as np

PYOPT = True
try:
from pyoptsparse import IPOPT, Optimization
except Exception:
PYOPT = False


def DTQPy_SOLVER_ipopt(H,f,A,b,Aeq,beq,lb,ub,internal,opts):

Expand Down
14 changes: 8 additions & 6 deletions weis/dtqpy/solver/DTQPy_SOLVER_slsqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
Contributor: Athul Krishna Sundarrajan (AthulKrishnaSundarrajan on Github)
Primary Contributor: Daniel R. Herber (danielrherber on Github)
"""
# import pyoptsparse
from pyoptsparse import OPT, Optimization

from scipy import sparse


import argparse

import numpy as np
# import pyoptsparse
PYOPT = True
try:
from pyoptsparse import OPT, Optimization
except Exception:
PYOPT = False


def DTQPy_SOLVER_slsqp(H,f,A,b,Aeq,beq,lb,ub,internal,opts):
Expand Down Expand Up @@ -140,4 +142,4 @@ def Sens(self,xdict,funcs):
F = sol.fStar

# return
return X,F,internal,opts
return X,F,internal,opts

0 comments on commit 1643ab7

Please sign in to comment.