CUDAMemHelpers test: the FFT indexer wait case trims the allocation pool after its pools
The pools' indexers return their memory to the allocation pool when destroyed; without a trim the next GPU test in the same process (AdaptiveSpotFinderGPU_RunToRunReproducible) found the card taken and failed with out of memory. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8dbaa9f8d7
commit
ee8c95de1c
1 file changed
+33
-28
@@ -154,37 +154,42 @@ TEST_CASE("IndexerThreadPool_FFTIndexerWaitsForGPUWorkBeside", "[CUDAMemHelpers]
|
||||
}
|
||||
}
|
||||
};
|
||||
IndexerThreadPool probe(settings, IndexerConstruction::OnFirstUse, /*beside=*/true);
|
||||
IndexerThreadPool pool(settings, IndexerConstruction::OnFirstUse);
|
||||
// The pools' indexers go back to the allocation pool when they are destroyed; trim it after them, so
|
||||
// the next test finds the card free.
|
||||
{
|
||||
IndexerThreadPool probe(settings, IndexerConstruction::OnFirstUse, /*beside=*/true);
|
||||
IndexerThreadPool pool(settings, IndexerConstruction::OnFirstUse);
|
||||
|
||||
fill();
|
||||
{
|
||||
GPUWorkBeside work;
|
||||
CHECK(probe.Run(x, recip).error != nullptr);
|
||||
}
|
||||
{
|
||||
std::optional<GPUImagePass> image_pass(std::in_place);
|
||||
std::thread ends([&] {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
held.reset();
|
||||
image_pass.reset();
|
||||
});
|
||||
GPUWorkBeside work;
|
||||
CHECK(probe.Run(x, recip).error == nullptr);
|
||||
ends.join();
|
||||
}
|
||||
fill();
|
||||
{
|
||||
GPUWorkBeside work;
|
||||
CHECK(probe.Run(x, recip).error != nullptr);
|
||||
}
|
||||
{
|
||||
std::optional<GPUImagePass> image_pass(std::in_place);
|
||||
std::thread ends([&] {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
held.reset();
|
||||
image_pass.reset();
|
||||
});
|
||||
GPUWorkBeside work;
|
||||
CHECK(probe.Run(x, recip).error == nullptr);
|
||||
ends.join();
|
||||
}
|
||||
|
||||
fill();
|
||||
{
|
||||
std::optional<GPUWorkBeside> work(std::in_place);
|
||||
std::thread ends([&] {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
held.reset();
|
||||
work.reset();
|
||||
});
|
||||
CHECK(pool.Run(x, recip).error == nullptr);
|
||||
ends.join();
|
||||
fill();
|
||||
{
|
||||
std::optional<GPUWorkBeside> work(std::in_place);
|
||||
std::thread ends([&] {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
held.reset();
|
||||
work.reset();
|
||||
});
|
||||
CHECK(pool.Run(x, recip).error == nullptr);
|
||||
ends.join();
|
||||
}
|
||||
}
|
||||
cuda_trim_allocation_pool();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user