Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing and debugging on macs #206

Merged
merged 15 commits into from
Feb 1, 2023
63 changes: 32 additions & 31 deletions .github/workflows/CI_WEIS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,63 @@ jobs:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"] #, "macOS-latest"]
os: ["ubuntu-latest", "macOS-latest"]
python-version: ["3.9","3.10"]

steps:
- uses: actions/checkout@v3

# This is the more official way to do miniconda, but it messes with the GitHub worker environment and shell quite a bit
#- uses: conda-incubator/setup-miniconda@v2
# # https://github.com/marketplace/actions/setup-miniconda
# with:
# miniconda-version: "latest"
# channels: conda-forge
# auto-update-conda: true
# python-version: ${{ matrix.python-version }}
# environment-file: environment.yml
# activate-environment: test
# auto-activate-base: false

# This is a less official, but more lightweight way to do miniconda
- uses: s-weigand/setup-conda@v1
# https://github.com/marketplace/actions/setup-conda
- uses: conda-incubator/setup-miniconda@v2
# https://github.com/marketplace/actions/setup-miniconda
with:
update-conda: true
miniconda-version: "latest"
channels: conda-forge
auto-update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: conda-forge
activate-conda: true
- run: conda env update --file environment.yml
environment-file: environment.yml
activate-environment: test
auto-activate-base: false

# This is a less official, but more lightweight way to do miniconda
#- uses: s-weigand/setup-conda@v1
# # https://github.com/marketplace/actions/setup-conda
# with:
# update-conda: true
# python-version: ${{ matrix.python-version }}
# conda-channels: conda-forge
# activate-conda: true
#- run: conda env update --file environment.yml

#- name: Show custom environment
# shell: bash
# run: |
# cat $GITHUB_ENV
# printenv

# Install dependencies of WISDEM specific to windows
- name: Add dependencies mac specific
if: contains( matrix.os, 'mac')
run: |
conda install -y compilers
gfortran --version

# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython

# Install dependencies of WEIS specific to ubuntu
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
shell: bash
# (if you use the shell here, cannot use 'compiler' package otherwise get link problems to system libraries
# Mpi only seems to work with the shell command though, so instead rely on system compilers
run: |
conda install -y petsc4py mpi4py openmpi
python -c "import platform; print(platform.node())"

# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython

- name: Show custom environment
shell: bash
run: |
conda list

Expand All @@ -77,19 +82,16 @@ jobs:

# Install WEIS
- name: Install WEIS
shell: bash
run: |
python setup.py develop

# List the collected tests for debugging purposes
- name: List tests
shell: bash
run: |
pytest weis --collect-only

# Run all tests within WEIS, but not computationally expensive examples
- name: Run tests within WEIS
shell: bash
run: |
pytest weis --cov-config=.coverageac --cov=weis

Expand All @@ -98,7 +100,6 @@ jobs:
if: contains( matrix.os, 'ubuntu')
# This also works, https://github.com/AndreMiras/coveralls-python-action
#uses: AndreMiras/coveralls-python-action@develop
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
68 changes: 37 additions & 31 deletions .github/workflows/run_exhaustive_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,58 +23,67 @@ jobs:
- uses: actions/checkout@v3

# This is the more official way to do miniconda, but it messes with the GitHub worker environment and shell quite a bit
#- uses: conda-incubator/setup-miniconda@v2
# # https://github.com/marketplace/actions/setup-miniconda
# with:
# miniconda-version: "latest"
# channels: conda-forge
# auto-update-conda: true
# python-version: ${{ matrix.python-version }}
# environment-file: environment.yml
# activate-environment: test
# auto-activate-base: false

# This is a less official, but more lightweight way to do miniconda
- uses: s-weigand/setup-conda@v1
# https://github.com/marketplace/actions/setup-conda
- uses: conda-incubator/setup-miniconda@v2
# https://github.com/marketplace/actions/setup-miniconda
with:
update-conda: true
miniconda-version: "latest"
channels: conda-forge
auto-update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: conda-forge
activate-conda: true
- run: conda env update --file environment.yml
environment-file: environment.yml
activate-environment: test
auto-activate-base: false

# This is a less official, but more lightweight way to do miniconda
#- uses: s-weigand/setup-conda@v1
# # https://github.com/marketplace/actions/setup-conda
# with:
# update-conda: true
# python-version: ${{ matrix.python-version }}
# conda-channels: conda-forge
# activate-conda: true
#- run: conda env update --file environment.yml

#- name: Show custom environment
# shell: bash
# run: |
# cat $GITHUB_ENV
# printenv

# Install dependencies of WISDEM specific to windows
- name: Add dependencies mac specific
if: contains( matrix.os, 'mac')
run: |
conda install -y compilers
gfortran --version

# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain libpython

# Install dependencies of WEIS specific to ubuntu
- name: Add dependencies ubuntu specific
if: false == contains( matrix.os, 'windows')
shell: bash
# (if you use the shell here, cannot use 'compiler' package otherwise get link problems to system libraries
# Mpi only seems to work with the shell command though, so instead rely on system compilers
run: |
conda install -y petsc4py mpi4py openmpi
python -c "import platform; print(platform.node())"

# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
if: contains( matrix.os, 'windows')
- name: Show custom environment
run: |
conda install -y m2w64-toolchain libpython
conda list

# Debugging session
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

# Install WEIS
- name: Install WEIS
shell: bash
run: |
python setup.py develop

# Debugging session
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

# Test walkthrough notebook
- name: Test postprocessing notebooks
Expand All @@ -89,14 +98,12 @@ jobs:

# Run all examples
- name: Run tests within WEIS
shell: bash
run: |
cd weis/test
python run_examples.py

# Run scripts within rotor_opt folder with MPI
- name: Run parallel examples rotor optimization
shell: bash
run: |
cd examples/05_IEA-3.4-130-RWT
mpirun -np 2 python weis_driver.py
Expand All @@ -109,7 +116,6 @@ jobs:

# Run scripts within design of experiments folder
- name: Run examples design of experiments
shell: bash
run: |
cd examples/09_design_of_experiments
mpirun -n 2 --bind-to core python DOE_openfast.py
Expand Down
13 changes: 9 additions & 4 deletions OpenFAST/cmake/FindMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ find_library(MKL_CORE_LIB
PATHS ${MKLSEARCHPATHS}
NO_DEFAULT_PATH)

if (MKL_IFACE_LIB AND MKL_SEQ_LIB AND MKL_CORE_LIB)
set(MKL_LIBRARIES ${MKL_IFACE_LIB} ${MKL_SEQ_LIB} ${MKL_CORE_LIB})
find_library(MKL_RT_LIB
NAMES mkl_rt libmkl_rt mkl_rt_dll
PATHS ${MKLSEARCHPATHS}
NO_DEFAULT_PATH)

if (MKL_IFACE_LIB AND MKL_SEQ_LIB AND MKL_CORE_LIB AND MKL_RT_LIB)
set(MKL_LIBRARIES ${MKL_RT_LIB} ${MKL_IFACE_LIB} ${MKL_SEQ_LIB} ${MKL_CORE_LIB})
else()
set(MKL_LIBRARIES "")
set(MKL_INCLUDE_DIRS "")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKL DEFAULT_MSG
MKL_LIBRARIES MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB) # MKL_INCLUDE_DIRS)
MKL_LIBRARIES MKL_RT_LIB MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB) # MKL_INCLUDE_DIRS)
mark_as_advanced(
MKL_INCLUDE_DIRS MKL_LIBRARIES MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB)
MKL_INCLUDE_DIRS MKL_LIBRARIES MKL_RT_LIB MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB)
36 changes: 25 additions & 11 deletions pyHAMS/.github/workflows/CI_pyHAMS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,38 @@ jobs:
shell: bash -l {0}

strategy:
fail-fast: False
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1

- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
id: cp
with:
python-version: ${{ matrix.python-version }}
update-environment: true

#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- name: Pip Install pyHAMS
env:
MESON_ARGS: -Dpython_target=${{ steps.cp.outputs.python-path }}
run: |
pip install -vv -e .
'${{ steps.cp.outputs.python-path }}' -m pip install -vv -e .

- name: Test run
run: |
cd test
python test_cylinder.py
'${{ steps.cp.outputs.python-path }}' test_cylinder.py


build_conda:
Expand All @@ -48,14 +55,14 @@ jobs:
shell: bash -l {0}

strategy:
fail-fast: False
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
# https://github.com/marketplace/actions/setup-miniconda
Expand All @@ -74,6 +81,13 @@ jobs:
run: |
conda install -y m2w64-toolchain libpython

# Install dependencies of WISDEM specific to windows
- name: Add dependencies windows specific
if: contains( matrix.os, 'mac')
run: |
conda install -y compilers
gfortran --version

# Install
- name: Conda Install pyHAMS
run: |
Expand Down
30 changes: 6 additions & 24 deletions pyHAMS/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,14 @@ if not omp.found()
endif

if fc.get_id() == 'gcc'
lapack = dependency('openblas', required: false)
if not lapack.found()
lapack = fc.find_library('openblas', required: false)
endif
if not lapack.found()
lapack = dependency('lapack', required: false)
endif
if not lapack.found()
lapack = fc.find_library('lapack', required: false)
endif
if not lapack.found()
lapack = declare_dependency(
link_args: '-llapack',
)
endif
lapack = declare_dependency(
link_args: '-llapack',
)
endif
if fc.get_id() == 'intel'
lapack = dependency('mkl', required: false)
if not lapack.found()
lapack = fc.find_library('mkl_rt')
endif
if not lapack.found()
lapack = declare_dependency(
link_args: '-lmkl_rt',
)
endif
lapack = declare_dependency(
link_args: '-lmkl_rt',
)
endif

# https://mesonbuild.com/Python-module.html
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def build_extension(self, ext):
if pkg in ['WISDEM', 'pyHAMS']:
# This option runs `python setup.py install/develop` on each package
os.system(sys.executable+" setup.py develop")
#retval = subprocess.call([sys.executable, "setup.py", "develop"])
else:
run_setup('setup.py', script_args=sys.argv[1:], stop_after='run')
os.chdir('..')
Expand Down