diff --git a/.github/workflows/perfmon.yml b/.github/workflows/perfmon.yml index 76140c9469..8fd314cee3 100644 --- a/.github/workflows/perfmon.yml +++ b/.github/workflows/perfmon.yml @@ -40,10 +40,26 @@ 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 @@ -51,3 +67,9 @@ jobs: - 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 diff --git a/.testing/Makefile b/.testing/Makefile index aabe51c8b6..f7101a3463 100644 --- a/.testing/Makefile +++ b/.testing/Makefile @@ -217,7 +217,6 @@ endif FMS_SOURCE = $(call SOURCE,deps/fms/src) - #--- # Rules @@ -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/%