Replace LOG by LOG_EVERY_N to avoid log spamming (#71755)
Summary:
The warning in DDP can cause log spamming. Suggest printing this warning every N times instead.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71755
Reviewed By: albanD
Differential Revision: D33763034
Pulled By: rohan-varma
fbshipit-source-id: 2d2fe691979b0c7f96a40ca6f9cd29a80b4395dd
(cherry picked from commit 7d879b98e24b978cba5d94a753ddfc781a240933)
diff --git a/torch/csrc/distributed/c10d/reducer.cpp b/torch/csrc/distributed/c10d/reducer.cpp
index 6d0ebad..00b1b5c 100644
--- a/torch/csrc/distributed/c10d/reducer.cpp
+++ b/torch/csrc/distributed/c10d/reducer.cpp
@@ -8,6 +8,7 @@
#include <c10/core/DeviceGuard.h>
#include <c10/core/StreamGuard.h>
#include <c10/util/Exception.h>
+#include <c10/util/Logging.h>
#include <c10/util/hash.h>
#include <c10/util/irange.h>
#include <c10d/comm.hpp>
@@ -365,7 +366,7 @@
// themselves in order to compute higher order derivatives. However,
// DDP will not sync up these gradients currently (see
// https://github.com/pytorch/pytorch/issues/63812).
- LOG(WARNING)
+ C10_LOG_EVERY_N(WARNING, 1000)
<< "Using DistributedDataParallel with create_graph=True "
<< " is not well-supported. The higher-order gradient will "
<< " not be synchronized across ranks, and backpropagation "