diff --git a/image_analysis/scale_merge/RotationScaleMergeGPU.cu b/image_analysis/scale_merge/RotationScaleMergeGPU.cu index 15e3ebf7d..8ed922149 100644 --- a/image_analysis/scale_merge/RotationScaleMergeGPU.cu +++ b/image_analysis/scale_merge/RotationScaleMergeGPU.cu @@ -713,11 +713,15 @@ struct RotationScaleMergeGPU::Impl { // end and is asked for again - the same buffer, so what the merge computes does not depend on the // wait. It is asked for again also when nothing is running beside it any more: work that ended // between the failure and the check has just given its memory back. + // + // The failed allocation is handled here, so its error must not stay behind as this thread's last + // error: the next kernel launch's cudaGetLastError() would report it over work that went fine. template CudaDevicePtr Alloc(size_t n) const { try { return CudaDevicePtr(n, ALLOC); } catch (const JFJochException &) { + cuda_clear_error(); } if (!wait_for_gpu_work_beside(GPU_BUSY_TIMEOUT)) ThrowGPUBusy(n_obs);