From d038746e1c9c20ddda5c548a3c4d666b88238116 Mon Sep 17 00:00:00 2001 From: Huihuang Zheng Date: Tue, 29 Dec 2020 09:39:00 +0800 Subject: [PATCH] Fix Unix Sleep for Wrong Time. test=develop (#29953) PADDLE_RETRY_CUDA_SUCCESS used wrong sleep time so it can cause timeout in unittest. This PR fixed it. After we searched the doc in https://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html, the time unit of sleep in unistd.h takes "seconds", usleep takes "microseconds", Sleep in windows.h takes "milliseconds". --- paddle/fluid/platform/enforce.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/platform/enforce.h b/paddle/fluid/platform/enforce.h index 944fd75b2a2..9ece502281e 100644 --- a/paddle/fluid/platform/enforce.h +++ b/paddle/fluid/platform/enforce.h @@ -932,7 +932,7 @@ inline void retry_sleep(unsigned millisecond) { #ifdef _WIN32 Sleep(millisecond); #else - sleep(millisecond); + usleep(millisecond * 1000); #endif } -- GitLab