Cache data_packer lengths in Sync_start to skip redundant buffer-size traversals

The data_packer(NULL, ...) calls that compute send/recv buffer lengths
traverse all grid segments × variables × nprocs on every Sync_start
invocation, even though lengths never change once the cache is built.
Add a lengths_valid flag to SyncCache so these length computations are
done once and reused on subsequent calls (4× per RK4 step).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-02-10 21:39:22 +08:00
parent d06d5b4db8
commit e09ae438a2
2 changed files with 26 additions and 7 deletions

View File

@@ -97,6 +97,7 @@ namespace Parallel
MPI_Request *reqs;
MPI_Status *stats;
int max_reqs;
bool lengths_valid;
SyncCache();
void invalidate();
void destroy();