Our use of filters in CTSM degrades performance and doesn't allow any loops that use them to vectorize
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
A core aspect of CTSM's architecture is the use of filters for looping. These were originally put in place to help performance - and particularly (I think) to help vectorizability of the code. I've wondered, though, if they still help performance overall on current architectures, compared with a simple loop with a conditional inside (i.e., we'd still only operate on the same points, but we'd do so via a conditional rather than via indirect indexing). I'm wondering if the indirect indexing might hurt more than it helps.
I could especially imagine filters hurting more than helping in cases where the subgrid structure is set up to mainly contain points of a single column type (e.g., all natural vegetation), like what @barlage is doing for comparison with Noah-MP.
It could be worth timing a few representative samples with the current filter-based approach vs. a simple loop with nested conditional.
Contributor guide
Assessment
This issue has not been assessed yet.