1 #include "caffe2/core/context.h" 13 static std::atomic<uint32_t> seedInput(0);
14 auto tv = std::chrono::system_clock::now().time_since_epoch();
15 uint64_t usec =
static_cast<uint64_t
>(
16 std::chrono::duration_cast<std::chrono::microseconds>(tv).count());
17 uint32_t tv_sec = usec / 1000000;
18 uint32_t tv_usec = usec % 1000000;
19 const uint32_t kPrime0 = 51551;
20 const uint32_t kPrime1 = 61631;
21 const uint32_t kPrime2 = 64997;
22 const uint32_t kPrime3 = 111857;
23 return kPrime0 * (seedInput++) + kPrime1 * static_cast<uint32_t>(getpid()) +
24 kPrime2 * tv_sec + kPrime3 * tv_usec;
28 inline void CopyBytesImpl(
size_t nbytes,
const void* src,
void* dst) {
34 memcpy(dst, src, nbytes);
37 void CopyBytesWrapper(
43 CopyBytesImpl(nbytes, src, dst);
47 void CPUContext::CopyBytesSameDevice(
51 CopyBytesImpl(nbytes, src, dst);
60 REGISTER_COPY_BYTES_FUNCTION(
63 caffe2::CopyBytesWrapper);
The CPU Context, representing the bare minimum of what a Context class in Caffe2 should implement...
Represents a a compute device on which a tensor is located.
uint32_t RandomNumberSeed()
A function to generate a random number seed that is unique in a best-effort basis, using an ever-incrementing seed and the current time.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Flush-To-Zero and Denormals-Are-Zero mode.