Skip to content

Commit

Permalink
Merge pull request #720 from nrmendoza/f/CCT2-IFW_wrapper
Browse files Browse the repository at this point in the history
inflowWind C-bound interface and python wrapper
  • Loading branch information
rafmudaf authored Sep 30, 2021
2 parents c427ea2 + 7af1199 commit 7a59bec
Show file tree
Hide file tree
Showing 15 changed files with 1,366 additions and 79 deletions.
20 changes: 18 additions & 2 deletions .github/actions/tests-module-inflowwind/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
name: 'InflowWind module tests'
description: 'Run tests specific to the InflowWind module'
author: 'Rafael Mudafort https://github.com/rafmudaf'

inputs:
test-target:
description: 'Which tests to run: unit | regression | all'
default: 'all'

runs:
using: "composite"
steps:
- run: ctest -VV -R inflowwind_utest
steps:
- run: |
if [[ ${{ inputs.test-target }} == "unit" ]] || [[ ${{ inputs.test-target }} == "all" ]]; then
ctest -VV -R inflowwind_utest
fi
if [[ ${{ inputs.test-target }} == "regression" ]] || [[ ${{ inputs.test-target }} == "all" ]]; then
ctest -VV -j7 -R ifw_ -LE python
# Exclude the Python-interface tests since those are run directly in the job
fi
working-directory: ${{runner.workspace}}/openfast/build
shell: bash
55 changes: 37 additions & 18 deletions .github/workflows/automated-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ jobs:
test-target: regression
- name: Run HydroDyn tests
uses: ./.github/actions/tests-module-hydrodyn
- name: Run InflowWind tests
uses: ./.github/actions/tests-module-inflowwind
with:
test-target: regression
- name: Run SubDyn tests
uses: ./.github/actions/tests-module-subdyn
- name: Run OpenFAST tests
Expand Down Expand Up @@ -143,6 +147,7 @@ jobs:
cmake --build . --target aerodyn_driver -- -j ${{env.NUM_PROCS}}
cmake --build . --target beamdyn_driver -- -j ${{env.NUM_PROCS}}
cmake --build . --target hydrodyn_driver -- -j ${{env.NUM_PROCS}}
cmake --build . --target inflowwind_driver -- -j ${{env.NUM_PROCS}}
cmake --build . --target subdyn_driver -- -j ${{env.NUM_PROCS}}
- name: Run AeroDyn tests
Expand All @@ -155,6 +160,10 @@ jobs:
test-target: regression
- name: Run HydroDyn tests
uses: ./.github/actions/tests-module-hydrodyn
- name: Run InflowWind tests
uses: ./.github/actions/tests-module-inflowwind
with:
test-target: regression
- name: Run SubDyn tests
uses: ./.github/actions/tests-module-subdyn

Expand Down Expand Up @@ -213,12 +222,12 @@ jobs:
pip install numpy Bokeh==1.4
- name: Setup Workspace
run: cmake -E make_directory ${{runner.workspace}}/build
run: cmake -E make_directory ${{runner.workspace}}/openfast/build
- name: Configure Build
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/openfast/install \
-DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \
-DOPENMP:BOOL=ON \
-DBUILD_FASTFARM:BOOL=ON \
Expand All @@ -228,15 +237,15 @@ jobs:
${GITHUB_WORKSPACE}
- name: Build FAST.Farm
# if: contains(github.event.head_commit.message, 'Action - Test All') || contains(github.event.pull_request.labels.*.name, 'Action - Test All')
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake --build . --target FAST.Farm -- -j ${{env.NUM_PROCS}}
cmake --build . --target regression_tests -- -j ${{env.NUM_PROCS}}
- name: Run FAST.Farm tests
run: |
ctest -VV -L fastfarm -j ${{env.NUM_PROCS}}
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
shell: bash

- name: Failing test artifacts
Expand All @@ -245,7 +254,7 @@ jobs:
with:
name: test-results
path: |
${{runner.workspace}}/build/reg_tests/glue-codes/fastfarm
${{runner.workspace}}/openfast/build/reg_tests/glue-codes/fastfarm
unit-test:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -298,6 +307,8 @@ jobs:
test-target: unit
- name: Run InflowWind tests
uses: ./.github/actions/tests-module-inflowwind
with:
test-target: unit

- name: Generate coverage report
working-directory: ${{runner.workspace}}/openfast/build
Expand Down Expand Up @@ -346,25 +357,25 @@ jobs:
with:
submodules: recursive
- name: Setup
run: cmake -E make_directory ${{runner.workspace}}/build
run: cmake -E make_directory ${{runner.workspace}}/openfast/build
- name: Configure
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/openfast/install \
-DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DDOUBLE_PRECISION:BOOL=OFF \
-DGENERATE_TYPES:BOOL=ON \
${GITHUB_WORKSPACE}
- name: Build all
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
run: cmake --build . --target all -- -j ${{env.NUM_PROCS}}
- name: Test
working-directory: ${{runner.workspace}}/build
working-directory: ${{runner.workspace}}/openfast/build
run: ./glue-codes/openfast/openfast -v

cpp-interface-tests:
interface-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand Down Expand Up @@ -403,17 +414,24 @@ jobs:
-DCODECOV:BOOL=ON \
${GITHUB_WORKSPACE}
- name: Build OpenFAST C++ API
- name: Build OpenFAST C-Interfaces
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake --build . --target openfastlib -- -j ${{env.NUM_PROCS}}
cmake --build . --target openfastcpp -- -j ${{env.NUM_PROCS}}
cmake --build . --target ifw_c_binding -- -j ${{env.NUM_PROCS}}
cmake --build . --target regression_tests -- -j ${{env.NUM_PROCS}}
- name: Run OpenFAST C++ API tests
- name: Run C++ API tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
ctest -VV -L cpp
- name: Run Python API tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
ctest -VV -L python
- name: Generate coverage report
working-directory: ${{runner.workspace}}/openfast/build
run: |
Expand All @@ -436,15 +454,16 @@ jobs:
uses: actions/upload-artifact@v2
if: success()
with:
name: cpp-reg-tests
name: c-interface-reg-tests
path: |
${{runner.workspace}}/openfast/regressioncov.xml
- name: Failing test artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: cpp-reg-tests
name: c-interface-reg-tests
path: |
${{runner.workspace}}/build/reg_tests/glue-codes/openfast-cpp
!${{runner.workspace}}/build/reg_tests/glue-codes/openfast-cpp/5MW_Baseline
${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast-cpp
${{runner.workspace}}/openfast/build/reg_tests/modules/inflowwind
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast-cpp/5MW_Baseline
11 changes: 9 additions & 2 deletions modules/inflowwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set(IFW_SOURCES
src/IfW_UserWind.f90
src/IfW_UniformWind.f90
src/InflowWind_Subs.f90
src/InflowWind.f90
src/InflowWind.f90
src/Lidar.f90
src/IfW_FFWind_Base.f90
src/IfW_FFWind_Base_Types.f90
Expand All @@ -51,6 +51,13 @@ set(IFW_SOURCES
add_library(ifwlib ${IFW_SOURCES})
target_link_libraries(ifwlib nwtclibs)

# C-bound interface library
add_library(ifw_c_binding SHARED src/IfW_C_Binding.f90)
target_link_libraries(ifw_c_binding ifwlib)
if(APPLE OR UNIX)
target_compile_definitions(ifw_c_binding PUBLIC -DIMPLICIT_DLLEXPORT)
endif()

set(IFW_DRIVER_SOURCES
src/InflowWind_Driver_Types.f90
src/InflowWind_Driver_Subs.f90
Expand All @@ -60,7 +67,7 @@ set(IFW_DRIVER_SOURCES
add_executable(inflowwind_driver ${IFW_DRIVER_SOURCES})
target_link_libraries(inflowwind_driver ifwlib ${CMAKE_DL_LIBS})

install(TARGETS inflowwind_driver ifwlib
install(TARGETS inflowwind_driver ifwlib ifw_c_binding
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
Expand Down
Loading

0 comments on commit 7a59bec

Please sign in to comment.