Skip to content

Avoid unnecessary elastic parameter calculations in SH mode - #1283

Merged
danielpeter merged 1 commit into
SPECFEM:develfrom
whahnsr:optimize-viscoelastic-sh-devel
Oct 13, 2026
Merged

danielpeter merged 1 commit into
SPECFEM:develfrom
whahnsr:optimize-viscoelastic-sh-devel

Conversation

@whahnsr

@whahnsr whahnsr commented Oct 11, 2026

Copy link
Copy Markdown

Summary

Avoid computing the Lamé parameter lambda and related quantities
when neither P_SV nor AXISYM is enabled.

In the SH case, these quantities are unused. The shear modulus
remains computed as before.

The change is confined to compute_forces_viscoelastic.F90.

Performance

Tested with the Tape2007 example using a serial gfortran build
with -O3 -finline-functions.

Baseline CPU user time (mean): approximately 6.73 s
Optimized CPU user times: 6.01, 6.03, 6.11, 6.01, 6.03 s
Optimized mean: 6.04 s

CPU time reduction: approximately 10.3%.

Numerical validation

All 132 generated seismogram files were compared using SHA-256.
Every file was bit-for-bit identical to the baseline output.

The P-SV and AXISYM calculations retain their original expressions.
Those configurations have not been separately benchmarked.

Note

This replaces the previous PR, which was closed because it
targeted master rather than devel.

The optimization commit has been cherry-picked directly onto
the current devel branch, without unrelated master commits.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.46%. Comparing base (7137639) to head (9a64ca3).

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #1283   +/-   ##
=======================================
  Coverage   49.46%   49.46%           
=======================================
  Files         171      171           
  Lines       31303    31304    +1     
  Branches     4951     4952    +1     
=======================================
+ Hits        15483    15484    +1     
  Misses      15820    15820           
Flag Coverage Δ
coverage-testname- 49.46% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielpeter

Copy link
Copy Markdown
Member

thanks for updating the PR!

@danielpeter
danielpeter merged commit 47b2b79 into SPECFEM:devel Oct 13, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants