Batched C14 ML Inference#42
Merged
Merged
Conversation
Collaborator
Author
See 77227e6 As indicated in the commit message I am not sure it is legal. It works though on EDIT: I think it is perfectly legal now... |
vopikamm
approved these changes
Apr 23, 2026
Collaborator
vopikamm
left a comment
There was a problem hiding this comment.
LGTM! I agree for tackling the buffer space issue when we need to.
All the cells in the problem are batched into a single forward model evaluation. Also the input data is transposed on Fortran side which results in inefficient memory layout. In this form we require quite large memory buffer. Non-optimal memory layout probably have little effect in a single column model, but may become significant in larger problems. Batching does offer significant advantage over 'loop' though. On a single column BOMEX test case we observe x10 speedup in ML inference time.
9180246 to
7bb884f
Compare
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.
This PR is stacked on top of #39 and #40.
Closes #30 and #35
It is not great in its current form since it suffers from two defects:
6 * nz*ngrid, so basically like storing 6 extra fields. It is a lotIn discussion with @jatkinson1000 we decided to 'kick the can down the road' when it comes to reducing the buffer space. We will address it when we need it.
Memory layout could be improved, but permuting a
torch_tensoron construction on after construction is a bit clunky ATM (I am punished for not merging Cambridge-ICCS/FTorch#423 😅 ). I will poke a bit more to see how it would look like so we can choose between potentially better performance and 'hackly' implementation.The speedup of batching is significant. On single column model with BOMEX we are talkign ~ x10 (from ~0.5s to ~0.05s)