Skip to content

Commit

Permalink
Add a CI workflow for a Linux GCC build (and run) test (erf-model#11)
Browse files Browse the repository at this point in the history
This is an outcome of the NERSC week hackathon which I used to learn CI workflows from the experienced folks at NERSC.

It checks out specific ERF and AMR-Wind branches from my personal forks as the dependencies for now.

The Couette flow simulation test is commented out for now as it is hanging.
  • Loading branch information
mukul1992 authored May 16, 2024
1 parent de02130 commit 5f4ff8f
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 14 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Linux GCC

on: [push, pull_request]

#concurrency:
# group: ${{ github.ref }}-${{ github.head_ref }}-linux-gcc
# cancel-in-progress: true

jobs:
library:
name: [email protected] C++17 Release
runs-on: ubuntu-20.04
# env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual"}
steps:
- name: checkout driver
uses: actions/checkout@v3

- name: checkout ERF
uses: actions/checkout@v3
with:
repository: mukul1992/ERF.git
ref: preserve-amrw-coupling
submodules: true
path: ERF
- name: checkout amr-wind
uses: actions/checkout@v3
with:
repository: mukul1992/amr-wind.git
ref: new-erf-coupling
submodules: true
path: amr-wind

- name: Install Dependencies
run: ${{github.workspace}}/ERF/Submodules/AMReX/.github/workflows/dependencies/dependencies.sh

- name: Configure Project and Generate Build System
run: |
cmake \
-B${{runner.workspace}}/erf-amrwind-driver/build \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/erf-amrwind-driver/install \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DCMAKE_C_COMPILER:STRING=mpicc \
-DCMAKE_Fortran_COMPILER:STRING=mpifort \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DAMRWIND_HOME:STRING=${{github.workspace}}/amr-wind \
-DERF_HOME:STRING=${{github.workspace}}/ERF \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=OFF \
-DERF_ENABLE_FCOMPARE:BOOL=ON \
-DERF_ENABLE_DOCUMENTATION:BOOL=OFF \
-DERF_ENABLE_MULTIBLOCK:BOOL=ON \
${{github.workspace}};
- name: Compile and Link
run: |
cd ${{runner.workspace}}/erf-amrwind-driver/build
make -j 8
- name: Run Couette flow problem
run: |
cd ${{runner.workspace}}/erf-amrwind-driver/build
cd Exec/CouetteFlow
cp ${{runner.workspace}}/erf-amrwind-driver/Exec/CouetteFlow/input* .
# ./erf_mb_couette inputs_amrex input_erf1 input_amrwind
13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
datlog
log.*

# Ignore everything in Build except the cmake script
/Build/*
!/Build/cmake.sh
!/Build/cmake_cuda.sh
!/Build/cmake_hip_crusher.sh
!/Build/cmake_hip.sh
!/Build/cmake_sycl.sh
!/Build/cmake_with_moisture.sh
!/Build/cmake_with_netcdf.sh
!/Build/cmake_with_poisson.sh
!/Build/cmake_with_warm_no_precip.sh
!/Build/cmake_mpi.sh

*build

# Temporary files
Expand Down
20 changes: 20 additions & 0 deletions Build/cmake_mpi_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Example CMake config script for an OSX laptop with OpenMPI

cmake -DCMAKE_INSTALL_PREFIX:PATH=./install \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DCMAKE_C_COMPILER:STRING=mpicc \
-DCMAKE_Fortran_COMPILER:STRING=mpifort \
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DAMRWIND_HOME:STRING=$HOME/amr-wind \
-DERF_HOME:STRING=$HOME/ERF \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=OFF \
-DERF_ENABLE_FCOMPARE:BOOL=ON \
-DERF_ENABLE_DOCUMENTATION:BOOL=OFF \
-DERF_ENABLE_MULTIBLOCK:BOOL=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \
.. && make -j8
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ cmake <options> ..
make -j8
```

The ERF and AMR-Wind root directory paths need to provided as the `ERF_HOME` and `AMRWIND_HOME` CMake variables. Template CMake scripts are provided in the `Build` directory for reference.
The ERF and AMR-Wind root directory paths need to provided as the `ERF_HOME` and `AMRWIND_HOME` CMake variables. Template CMake scripts are provided in the `Build` directory for reference.

[![Linux GCC Build and Run](https://github.com/mukul1992/erf-amrwind-driver/actions/workflows/gcc.yml/badge.svg)](https://github.com/mukul1992/erf-amrwind-driver/actions/workflows/gcc.yml)

0 comments on commit 5f4ff8f

Please sign in to comment.