Repository navigation
Conversation
TYPE: text only KEYWORDS: license, Apache-2.0, contributor license, doc/licenses SOURCE: Yoel Sevi (Google) DESCRIPTION OF CHANGES: Problem: Following the contributor-license mechanism established in PR wrf-model#2242 (doc/licenses/fraunhofer_license.txt), Google-authored code blocks in subsequent performance pull requests need a standalone permissive license file under doc/licenses/ while leaving WRF's root LICENSE.txt unmodified. Solution: Add doc/licenses/google_license.txt containing the Apache License, Version 2.0 (Copyright 2026 Google LLC), referenced by `! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/google_license.txt` and `! END LICENSE` comment markers around Google-authored code blocks. If maintainers prefer lower inline marker density on PRs with interleaved edits, I am happy to explore a lighter per-routine notice option. License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt). ISSUE: None LIST OF MODIFIED FILES: A doc/licenses/google_license.txt TESTS CONDUCTED: 1. Documentation-only addition under doc/licenses/; zero source, build, or runtime changes. 2. Pending upstream Jenkins CI. RELEASE NOTE: Add doc/licenses/google_license.txt (Apache-2.0) for Google-contributed performance patches.
…n_em TYPE: enhancement KEYWORDS: dyn_em, cal_deform_and_div, Smagorinsky, TKE, j-strip blocking, cache locality SOURCE: Yoel Sevi (Google) DESCRIPTION OF CHANGES: Problem: cal_deform_and_div in dyn_em/module_diffusion_em.F runs on every RK step under both mesoscale 2D Smagorinsky (km_opt = 4) and 3D TKE LES (km_opt = 2) configs and allocates eight full-tile 3D automatic arrays (mm, zz, zx, zy, tmp1, hat, hatavg, tmp2) across (its-2:ite+2, kts:kte, jts-2:jte+2). On mesoscale and LES tiles, these intermediates spill out of L1/L2 cache between metric setup and strain-rate divergence loops. Solution: Wrap the unchanged stencil body inside an internal subroutine cal_deform_and_div_strip(jts, jte) invoked over 4-row j-strips (J_STRIP = 4), merging strips within 2 rows of jds/jde so boundary conditions match full-tile execution bit-for-bit. License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt). ISSUE: None LIST OF MODIFIED FILES: M dyn_em/module_diffusion_em.F TESTS CONDUCTED: 1. On gfortran 15.2.0 (x86-64 Linux, 4-core VMs, MPICH), passed -fcheck=all and FPE-trap (zero, overflow) tests with quiet-NaN initialized locals (r4 and -r8, OMP_NUM_THREADS=1,4) across interior and symmetric/open/periodic boundary cases with max_abs_diff = 0.0 while shrinking eight full-tile 3D scratch arrays to 4-row j-strips. With signalling-NaN initialization the harness traps identically for unmodified and patched code, so bit-identity was checked in the quiet-NaN build. End-to-end impact of this change alone has not been measured. Built and verified as part of the full optimization series on x86-64 Linux (gfortran 15.2.0, MPICH, 4-core VMs, 5 interleaved repeats across 5 em_real workflows) across Make (serial, dmpar r4 and -r8, dm+sm), CMake (dmpar), and -DWRF_CHEM=1 with 0 new compiler warnings and bit-for-bit identical wrf.exe outputs (diffwrf = 0 with gfortran on x86-64 without fused multiply-add). 2. Pending upstream Jenkins CI (including Intel and non-x86 compilers). RELEASE NOTE: Cache-block cal_deform_and_div over 4-row j-strips in dyn_em/module_diffusion_em.F so 3D strain-rate scratch arrays stay cache-resident.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cache-block cal_deform_and_div over 4-row j-strips in module_diffusion_em.
TYPE: enhancement
KEYWORDS: dyn_em, cal_deform_and_div, Smagorinsky, TKE, j-strip blocking, cache locality
SOURCE: Yoel Sevi (Google)
DESCRIPTION OF CHANGES:
Problem:
cal_deform_and_div in dyn_em/module_diffusion_em.F runs on every RK step under
both mesoscale 2D Smagorinsky (km_opt = 4) and 3D TKE LES (km_opt = 2) configs
and allocates eight full-tile 3D automatic arrays (mm, zz, zx, zy, tmp1, hat,
hatavg, tmp2) across (its-2:ite+2, kts:kte, jts-2:jte+2). On mesoscale and LES
tiles, these intermediates spill out of L1/L2 cache between metric setup and
strain-rate divergence loops.
Solution:
Wrap the unchanged stencil body inside an internal subroutine
cal_deform_and_div_strip(jts, jte) invoked over 4-row j-strips (J_STRIP = 4),
merging strips within 2 rows of jds/jde so boundary conditions match full-tile
execution bit-for-bit.
License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt).
LIST OF MODIFIED FILES:
A doc/licenses/google_license.txt
M dyn_em/module_diffusion_em.F
TESTS CONDUCTED:
and FPE-trap (zero, overflow) tests with quiet-NaN initialized locals (r4
and -r8, OMP_NUM_THREADS=1,4) across interior and symmetric/open/periodic
boundary cases with max_abs_diff = 0.0 while shrinking eight full-tile 3D
scratch arrays to 4-row j-strips. With signalling-NaN initialization the
harness traps identically for unmodified and patched code, so bit-identity
was checked in the quiet-NaN build. End-to-end impact of this change alone
has not been measured.
Built and verified as part of the full optimization series on x86-64 Linux
(gfortran 15.2.0, MPICH, 4-core VMs, 5 interleaved repeats across 5 em_real
workflows) across Make (serial, dmpar r4 and -r8, dm+sm), CMake (dmpar),
and -DWRF_CHEM=1 with 0 new compiler warnings and bit-for-bit identical
wrf.exe outputs (diffwrf = 0 with gfortran on x86-64 without fused
multiply-add).
RELEASE NOTE: Cache-block cal_deform_and_div over 4-row j-strips in dyn_em/module_diffusion_em.F so 3D strain-rate scratch arrays stay cache-resident.
Part of the modular CPU performance series; combined multi-workflow benchmarks, hardware/compiler setup, and per-PR summary table are in the Series Overview comment on PR 01 (#2470).
Prepared with AI assistance (Google Gemini).