refactor: netcdf cache offsetting and index manipulation logic#1000
Open
aaraney wants to merge 1 commit into
Open
refactor: netcdf cache offsetting and index manipulation logic#1000aaraney wants to merge 1 commit into
aaraney wants to merge 1 commit into
Conversation
PhilMiller
reviewed
Jul 8, 2026
This also fixes a bug when the total forcing timesteps is not divisible by the cache line size.
aaraney
force-pushed
the
fix-nc-forcing-cache-indexing
branch
from
July 9, 2026 21:13
2dff085 to
463b86b
Compare
Member
Author
Contributor
|
This all would be much easier to work with if we had @hellkite500 @robertbartel Do you think we'd be OK importing a dependency on that header-only library? Is it worth running this by Chris and Donald? Does it help that the reference implementation came from another US government agency, with strict provenance and review processes on their open-source releases? |
PhilMiller
reviewed
Jul 14, 2026
|
|
||
| std::size_t idx1_cache_slice_start = idx1 - (idx1 % cache_slice_t_size); | ||
| std::size_t time_idx = idx1 % cache_slice_t_size; | ||
| std::size_t cache_line_size = cache_slice_t_size; |
Contributor
There was a problem hiding this comment.
I think this may still be incorrect for the case of a single page. I.e. a very short run, in which there are fewer time steps than the chunking granularity that will determine cache_slice_t_size
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.
Refactor the netcdf cache offsetting and index manipulation functions. This hopefully cleans up the logic a bit and makes it a little easier to follow and reason about (please be the judge of that :)). This also fixes a bug when the total forcing time steps are not divisible by the cache line size.
I still need to add tests, but a first review would be great! Thanks!