[1/N] Change #include <c10/util/Optional.h> to #include <optional> (#128301)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/128301
Approved by: https://github.com/ezyang
This commit is contained in:
cyy
2024-06-14 23:21:01 +00:00
committed by PyTorch MergeBot
parent 52d4442a00
commit bd72e28314
330 changed files with 1208 additions and 1207 deletions

View File

@ -11,8 +11,8 @@
#include <ATen/ATen.h>
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <nccl.h>
#include <optional>
#if defined(NCCL_MAJOR) && (NCCL_MAJOR == 2) && defined(NCCL_MINOR) && \
(NCCL_MINOR >= 14)
@ -183,7 +183,7 @@ bool shouldBroadcastNCCLUniqueID(bool isSendRecvSelf);
// thrown in the NCCL codebase.
TORCH_API std::string getNcclErrorDetailStr(
ncclResult_t error,
std::optional<std::string> processGroupFailureReason = c10::nullopt);
std::optional<std::string> processGroupFailureReason = std::nullopt);
// Write NCCL debug info to local disk or any storage users define.
// There are some constrains we set for the debug info writer:
@ -221,7 +221,7 @@ class NCCLComm {
: ncclComm_(ncclComm),
aborted_(false),
ncclAsyncErr_(ncclSuccess),
commFailureReason_(c10::nullopt),
commFailureReason_(std::nullopt),
initialized_(false) {}
NCCLComm() : NCCLComm(nullptr) {}
@ -249,7 +249,7 @@ class NCCLComm {
auto comm = std::make_shared<NCCLComm>();
C10D_NCCL_CHECK(
ncclCommInitRank(&(comm->ncclComm_), numRanks, commId, rank),
c10::nullopt);
std::nullopt);
comm->ncclId_ = commId;
comm->rank_ = rank;
comm->initialized_ = true;
@ -271,12 +271,12 @@ class NCCLComm {
C10D_NCCL_CHECK_NONBLOCKING(
ncclCommInitRankConfig(
&(comm->ncclComm_), numRanks, commId, rank, &config),
c10::nullopt);
std::nullopt);
} else {
C10D_NCCL_CHECK(
ncclCommInitRankConfig(
&(comm->ncclComm_), numRanks, commId, rank, &config),
c10::nullopt);
std::nullopt);
// under blocking mode, comm is initialized after NCCL CHECK
isInitialized = true;
}
@ -301,7 +301,7 @@ class NCCLComm {
LOG(INFO) << "Communicator was aborted before trying to dump its state.";
return dump;
}
C10D_NCCL_CHECK(::ncclCommDump(ncclComm_, dump), c10::nullopt);
C10D_NCCL_CHECK(::ncclCommDump(ncclComm_, dump), std::nullopt);
return dump;
}
#endif
@ -336,7 +336,7 @@ class NCCLComm {
}
void ncclCommAbort(
std::optional<std::string> commFailureReason = c10::nullopt) {
std::optional<std::string> commFailureReason = std::nullopt) {
std::unique_lock<std::mutex> lock(mutex_);
#ifdef ENABLE_NCCL_ERROR_CHECKING
if (aborted_) {