Skip to content

Commit

Permalink
Adding basic profiling tests (#56)
Browse files Browse the repository at this point in the history
* Adding basic profiling tests

* Fixing gmon path

* Adding pandas to profiling tests

* Sorting function names in profiling tests

* Adding averaging in profiling tests

* Updating timing tests to be a percentage of runtime
  • Loading branch information
Michael Wathen authored Oct 25, 2021
1 parent 5099a3d commit b7ac9e6
Show file tree
Hide file tree
Showing 6 changed files with 935 additions and 8 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/ersem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Building and installing GOTM-FABM-ERSEM
run: |
branch=$(git branch --show-current)
./github-actions/gotm-fabm-ersem/gotm-fabm-ersem-build.sh $branch
./github-actions/gotm-fabm-ersem/gotm-fabm-ersem-build.sh -b $branch
- name: Running tutorial
run: |
./github-actions/gotm-fabm-ersem/gotm-tut-config-setup.sh
Expand All @@ -55,7 +55,8 @@ jobs:
- name: Running gotm tests
run: |
python -m pip install pytest
pytest github-actions/gotm-fabm-ersem
pytest github-actions/gotm-fabm-ersem/test_state_variables.py github-actions/gotm-fabm-ersem/test_gotm.py
build-fabm0d-gotm-ersem-debian:
runs-on: ubuntu-latest
steps:
Expand All @@ -80,3 +81,24 @@ jobs:
run: |
python -m pip install pytest
pytest github-actions/fabm0d-gotm-ersem
build-gotm-profilling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Installing GOTM-FABM-ERSEM dependences
run: ./github-actions/gotm-fabm-ersem/gotm-fabm-ersem-dep-debian.sh
- name: Building and installing GOTM-FABM-ERSEM
run: |
branch=$(git branch --show-current)
./github-actions/gotm-fabm-ersem/gotm-fabm-ersem-build.sh -f "-DCMAKE_Fortran_FLAGS="-pg""
- name: Running config
run: |
./github-actions/gotm-fabm-ersem/gotm-profiling.sh
- name: Running gotm profilling
run: |
python -m pip install pytest pandas
pytest -s github-actions/gotm-fabm-ersem/test_profiling.py
16 changes: 13 additions & 3 deletions github-actions/fabm0d-gotm-ersem/fabm0d-gotm-ersem-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash
BRANCH=${1:-master}

BRANCH="master"
CMAKE_FLAG=""
while getopts ":b:f:" flag; do
case "${flag}" in
b) BRANCH=${OPTARG};;
f) CMAKE_FLAG=${OPTARG};;
esac
done

CPU="$(nproc)"

echo "Cloning ERSEM"
git clone https://github.com/pmlmodelling/ersem.git
Expand All @@ -16,5 +26,5 @@ cd ersem && git checkout $BRANCH && cd ..

echo "Building FABM-GOTM-ERSEM"
mkdir build && cd build
cmake ../fabm/src/drivers/0d -DGOTM_BASE=../gotm -DFABM_ERSEM_BASE=../ersem
make install
cmake ../fabm/src/drivers/0d -DGOTM_BASE=../gotm -DFABM_ERSEM_BASE=../ersem $CMAKE_FLAG
make install -j $CPU
15 changes: 12 additions & 3 deletions github-actions/gotm-fabm-ersem/gotm-fabm-ersem-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash
BRANCH=${1:-master}
BRANCH="master"
CMAKE_FLAG=""
while getopts ":b:f:" flag; do
case "${flag}" in
b) BRANCH=${OPTARG};;
f) CMAKE_FLAG=${OPTARG};;
esac
done

CPU="$(nproc)"

echo "Cloning ERSEM"
git clone https://github.com/pmlmodelling/ersem.git
Expand All @@ -16,5 +25,5 @@ cd ersem && git checkout $BRANCH && cd ..

echo "Building GOTM-FABM-ERSEM"
mkdir build && cd build
cmake ../gotm -DFABM_BASE=../fabm -DFABM_ERSEM_BASE=../ersem
make install
cmake ../gotm -DFABM_BASE=../fabm -DFABM_ERSEM_BASE=../ersem $CMAKE_FLAG
make install -j $CPU
13 changes: 13 additions & 0 deletions github-actions/gotm-fabm-ersem/gotm-profiling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "Cloning config repo"
git clone https://github.com/pmlmodelling/ersem-setups.git

cd ersem-setups/L4

echo "Running GOTM with repo configuration"
for i in {1..5}
do
~/local/gotm/bin/gotm
gprof -b -Q ~/local/gotm/bin/gotm gmon.out | awk -v OFS=',' '{print $1,$2,$3,$4,$5,$6,$7}' | sed -e '1,3d' > gprof_$i.csv
done
Loading

0 comments on commit b7ac9e6

Please sign in to comment.