Skip to content

Commit

Permalink
Add rule and workflow to compare results of micro-timing tests
Browse files Browse the repository at this point in the history
- Added rules to .testing/Makefile to invoke build.timing, run.timing for the
  "target" code checked out for regression tests
- Appended to existing GH "perfmon" workflow
  • Loading branch information
adcroft authored and marshallward committed Nov 22, 2023
1 parent d8579d2 commit 7cc191a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/perfmon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,36 @@ jobs:
sudo sysctl -w kernel.perf_event_paranoid=2
make perf DO_REGRESSION_TESTS=true
# This job assumes that build/target_codebase was cloned above
- name: Compile timing tests for reference code
if: ${{ github.event_name == 'pull_request' }}
run: >-
make -j build.timing_target
MOM_TARGET_SLUG=$GITHUB_REPOSITORY
MOM_TARGET_LOCAL_BRANCH=$GITHUB_BASE_REF
DO_REGRESSION_TESTS=true
- name: Compile timing tests
run: |
make -j build.timing
# DO_REGERESSION_TESTS=true is needed here to set the internal macro TARGET_CODEBASE
- name: Run timing tests for reference code
if: ${{ github.event_name == 'pull_request' }}
run: >-
make -j run.timing_target
DO_REGRESSION_TESTS=true
- name: Run timing tests
run: |
make -j run.timing
- name: Display timing results
run: |
make -j show.timing
- name: Display comparison of timing results
if: ${{ github.event_name == 'pull_request' }}
run: >-
make -j compare.timing
DO_REGRESSION_TESTS=true
19 changes: 18 additions & 1 deletion .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ endif

FMS_SOURCE = $(call SOURCE,deps/fms/src)


#---
# Rules

Expand Down Expand Up @@ -684,6 +683,24 @@ show.timing: $(foreach f, $(TIMING_EXECS), work/timing/$(f).show)
$(WORKSPACE)/work/timing/%.show:
./tools/disp_timing.py $(@:.show=.out)

# Invoke the above unit/timing rules for a "target" code
# Invoke with appropriate macros defines, i.e.
# make build.timing_target MOM_TARGET_URL=... MOM_TARGET_BRANCH=... TARGET_CODEBASE=build/target_codebase
# make run.timing_target TARGET_CODEBASE=build/target_codebase

TIMING_TARGET_EXECS ?= $(basename $(notdir $(wildcard $(TARGET_CODEBASE)/config_src/drivers/timing_tests/*.F90) ) )

.PHONY: build.timing_target
build.timing_target: $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/build/timing/$(f))
.PHONY: run.timing_target
run.timing_target: $(foreach f, $(TIMING_TARGET_EXECS), $(TARGET_CODEBASE)/.testing/work/timing/$(f).out)
.PHONY: compare.timing
compare.timing: $(foreach f, $(filter $(TIMING_EXECS),$(TIMING_TARGET_EXECS)), work/timing/$(f).compare)
$(WORKSPACE)/work/timing/%.compare: $(TARGET_CODEBASE)
./tools/disp_timing.py -r $(TARGET_CODEBASE)/.testing/$(@:.compare=.out) $(@:.compare=.out)
$(TARGET_CODEBASE)/.testing/%: | $(TARGET_CODEBASE)
cd $(TARGET_CODEBASE)/.testing && make $*

# General rule to run a unit test executable
# Pattern is to run build/unit/executable and direct output to executable.out
$(WORKSPACE)/work/unit/%.out: build/unit/%
Expand Down

0 comments on commit 7cc191a

Please sign in to comment.