in caching allocator, ignore and clear the error if not ready
authorJeff Daily <jeff.daily@amd.com>
Fri, 29 Mar 2019 00:43:22 +0000 (17:43 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 29 Mar 2019 00:53:30 +0000 (17:53 -0700)
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

index ff39c5c..5a7e8f9 100644 (file)
@@ -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);