/usr/local/lib64/python3.6/site-packages/torch/include/c10d
NameSizeModeActions
comm.hpp41840644editdlrm
default_comm_hooks.hpp14790644editdlrm
FileStore.hpp14030644editdlrm
frontend.hpp92520644editdlrm
frontend_cuda.hpp1420644editdlrm
GlooDeviceFactory.hpp7710644editdlrm
HashStore.hpp11310644editdlrm
logger.hpp39810644editdlrm
NCCLUtils.hpp80460644editdlrm
ParamCommsUtils.hpp18140644editdlrm
PrefixStore.hpp14040644editdlrm
ProcessGroup.hpp124350644editdlrm
ProcessGroupGloo.hpp133950644editdlrm
ProcessGroupMPI.hpp88240644editdlrm
ProcessGroupNCCL.hpp220410644editdlrm
ProcessGroupRoundRobin.hpp39920644editdlrm
ProcessGroupWrapper.hpp49710644editdlrm
reducer.hpp261210644editdlrm
sequence_num.hpp16830644editdlrm
Store.hpp25890644editdlrm
TCPStore.hpp32130644editdlrm
Types.hpp13700644editdlrm
UnixSockUtils.hpp28400644editdlrm
Utils.hpp216010644editdlrm
WinSockUtils.hpp27010644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/c10d/sequence_num.hpp (1683B)
#pragma once #include #include #include #include namespace c10d { const int kUnsetSeqNum = 0; namespace { constexpr int kByteOffset = 8; } // Converts from int to char vec to write in store template inline std::vector toVec(uint64_t num, int numBytes) { std::vector values; // Read off bytes from right to left, pushing them into // char array. for (const auto i : c10::irange(numBytes)) { uint8_t x = (num >> (kByteOffset * i)) & 0xff; values.push_back(static_cast(x)); } return values; } // Converts from char vec (such as from store read) to int. template inline uint64_t fromVec(const std::vector& values) { uint64_t num = 0; // Set each byte at the correct location on num for (const auto i : c10::irange(values.size())) { uint8_t x = static_cast(values[i]); num |= (static_cast(x) << (kByteOffset * i)); } return num; } class TORCH_API SequenceNum { public: SequenceNum(); explicit SequenceNum(const uint64_t num); // Retrieve num_. Will throw if not set. uint64_t get() const; // Increment num_. Will throw if not set. void increment(); // Increment num_ and return the old value. Will throw if not set. uint64_t getAndIncrement(); // Sets num_ void set(const uint64_t num); // Returns true if this SequenceNum is properly initialized with a value, else // false. bool isSet() const; SequenceNum& operator=(const SequenceNum& other); SequenceNum(const SequenceNum& other); private: c10::optional num_; mutable std::mutex lock_; }; } // namespace c10d