GPU memory: a probe pass hands its memory to the card when it ends
The speculative geometry probe and the rotation-scale walk's indexing probes gave their indexers' and image workers' buffers back to the allocation pool only, which kept them reserved under the main line's merge and analyses: 5.5 GB on 8qaw and 5.3 GB on 4nwv on the RTX 5080, until the end of the run. The pool is trimmed (every card: cuda_trim_allocation_pools) when such a probe ends, as IndexerThreadPool::ReleaseIndexers now does through the same helper. Measured (RTX 5080): device memory held at the end of the final merge 8.7 -> 3.4 GB (4nwv), 14.5 -> 7.7 GB (8qaw). Output unchanged: p.hkl byte-identical on cytc_x10sa, myob_x10sa, 4nwv and 8qaw, on this card and with its total read as 8.55 GB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f722227e8
commit
2091c0524a
4 files changed
+19
-4
No files matched your search
@@ -204,6 +204,14 @@ inline void cuda_trim_allocation_pool() {
|
||||
cudaGetLastError();
|
||||
}
|
||||
|
||||
// The same on every card: for work that has ended and whose threads were pinned round-robin (pin_gpu).
|
||||
inline void cuda_trim_allocation_pools() {
|
||||
for (int32_t d = 0; d < get_gpu_count(); d++) {
|
||||
ScopedGpuPin pin(d);
|
||||
cuda_trim_allocation_pool();
|
||||
}
|
||||
}
|
||||
|
||||
// Whether `bytes` more device memory can be had on the current device, for a step whose buffers are
|
||||
// sized by the data set and which ends the run when they do not fit. The free memory counts what the
|
||||
// pool holds with no buffer in it (up to CUDA_MEM_POOL_RELEASE_THRESHOLD) as taken, so that is handed
|
||||
|
||||
@@ -286,10 +286,7 @@ void IndexerThreadPool::ReleaseIndexers() {
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
// Their buffers went back to the allocation pool, which would keep them reserved for the next
|
||||
// buffer of whoever asks; hand them to the card.
|
||||
for (int32_t d = 0; d < get_gpu_count(); d++) {
|
||||
ScopedGpuPin pin(d);
|
||||
cuda_trim_allocation_pool();
|
||||
}
|
||||
cuda_trim_allocation_pools();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -569,6 +569,11 @@ void Rugnux::StartSpeculativeGeometryProbe(std::shared_ptr<Rugnux> run, const st
|
||||
Logger("Rugnux").Warning("Speculative geometry probe failed: {}", e.what());
|
||||
}
|
||||
}
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
// What its indexers and image workers held went back to the allocation pool; hand it to the card,
|
||||
// or it stays reserved under the merge and the validation beside which the probe ran.
|
||||
cuda_trim_allocation_pools();
|
||||
#endif
|
||||
});
|
||||
speculative_probe_ = std::move(sp);
|
||||
}
|
||||
|
||||
@@ -756,6 +756,11 @@ RotationScaleWalk Rugnux::WalkRotationScaleBeside(const ProcessResult &pass1, Ro
|
||||
// empty result reads as.
|
||||
logger.Info("Rotation scale {:.5f}: the probe pass did not complete ({})", k, e.what());
|
||||
}
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
// As the speculative probe (StartSpeculativeGeometryProbe): what it held goes back to the card.
|
||||
if (index_only)
|
||||
cuda_trim_allocation_pools();
|
||||
#endif
|
||||
return res;
|
||||
};
|
||||
const auto probe = [&](float k, bool index_only) {
|
||||
|
||||
Reference in new issue
Block a user