From 2f174e945384e87843733999abc5f16e54cd974b Mon Sep 17 00:00:00 2001 From: Jeff Daily Date: Thu, 28 Mar 2019 17:43:22 -0700 Subject: [PATCH] in caching allocator, ignore and clear the error if not ready Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18584 Differential Revision: D14675041 Pulled By: bddppq fbshipit-source-id: c1fab797e0d224e0a481a0395a3f9975c4265ff6 --- c10/cuda/CUDACachingAllocator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c10/cuda/CUDACachingAllocator.cpp b/c10/cuda/CUDACachingAllocator.cpp index ff39c5c..5a7e8f9 100644 --- a/c10/cuda/CUDACachingAllocator.cpp +++ b/c10/cuda/CUDACachingAllocator.cpp @@ -554,6 +554,8 @@ struct THCCachingAllocator cudaError_t err = cudaEventQuery(event); if (err == cudaErrorNotReady) { + // ignore and clear the error if not ready + cudaGetLastError(); break; } else if (err != cudaSuccess) { C10_CUDA_CHECK(err); -- 2.7.4