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

Fix bug in profiling code and create profiling CI #346

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/pyrealm_profiling_without_benchmarking.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Profiling without benchmarking

# This runs when a PR is opened, synchronised or reopened
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_call:

jobs:
test:
uses: ./.github/workflows/pyrealm_ci.yaml
secrets: inherit

profiling:
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.8.2

- name: Install dependencies and add env vars
run: |
poetry install
sudo apt-get install graphviz
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV

- name: Run the profiling test suite, using time to get peak memory usage
id: profiling
run: poetry run /usr/bin/time -v pytest -m "profiling" --profile-svg
4 changes: 2 additions & 2 deletions tests/profiling/pmodel/test_profiling_pmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def test_profiling_pmodel(pmodel_profile_data):

# Profiling the PModel submodule
# Standard C3 PModel
pmod_c3 = PModel(env=pm_env, kphio=1 / 8)
pmod_c3 = PModel(env=pm_env, reference_kphio=1 / 8)
pmod_c3.estimate_productivity(fapar=fapar, ppfd=ppfd)
pmod_c3.summarize()

# Standard C4 PModel
pmod_c4 = PModel(env=pm_env, kphio=1 / 8, method_optchi="c4")
pmod_c4 = PModel(env=pm_env, reference_kphio=1 / 8, method_optchi="c4")
pmod_c4.estimate_productivity(fapar=fapar, ppfd=ppfd)
pmod_c4.summarize()

Expand Down
Loading