[init] #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
extract-nd: | |
name: Compile sources and push 2d and 3d branches | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dimension: [2, 3] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: "NaokiHori/SpectralNSSolver1" | |
ref: ${{ github.ref_name }} | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install make libopenmpi-dev libfftw3-dev | |
- name: Remove another dimension | |
run: | | |
python .github/workflows/extract_nd_main.py ${{ matrix.dimension }} | |
- name: Modify Makefile | |
run: | | |
sed -i "s/DNDIMS=2/DNDIMS=${{ matrix.dimension }}/g" Makefile | |
- name: Compile | |
run: | | |
make all | |
- name: Commit and push change | |
run: | | |
set -x | |
set -e | |
git switch -c ${{ matrix.dimension }}d | |
git config --local user.email "[email protected]" | |
git config --local user.name "NaokiHori" | |
# not include documentation in each branch | |
git rm -r docs | |
# let IC generator of the given dimension as main.py | |
cd initial_condition | |
find . -type f -not -name ${{ matrix.dimension }}d.py | xargs git rm | |
git mv ${{ matrix.dimension }}d.py main.py | |
cd .. | |
# declare to track others, just in case | |
git add exec.sh | |
git add include | |
git add LICENSE | |
git add Makefile | |
git add README.rst | |
git add src | |
# commit and push | |
git commit -m "Extract ${{ matrix.dimension }}d sources" -a || true | |
git push -f origin ${{ matrix.dimension }}d | |
build-and-run: | |
name: Build library and try to run test case | |
runs-on: ubuntu-latest | |
needs: [extract-nd] | |
strategy: | |
matrix: | |
dimension: [2, 3] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: "NaokiHori/SpectralNSSolver1" | |
ref: ${{ matrix.dimension }}d | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install make libopenmpi-dev libfftw3-dev | |
- name: Install python dependencies for pre-processing | |
run: | | |
python -m pip install --upgrade pip | |
pip install numpy | |
- name: Pre-process | |
run: | | |
set -x | |
set -e | |
cd initial_condition | |
python3 main.py 0 | |
ls output | |
cd .. | |
- name: Build | |
run: | | |
set -x | |
set -e | |
make clean | |
make output | |
make all | |
- name: Run | |
run: | | |
export timemax=5.0e+0 | |
export wtimemax=6.0e+2 | |
export log_rate=5.0e-1 | |
export save_rate=1.0e+0 | |
export Re=1.0e+2 | |
export Sc=1.0e-1 | |
dirname_ic=initial_condition/output | |
mpirun -n 4 --oversubscribe ./a.out ${dirname_ic} | |