MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / InitOrCheckMetaValue

Function InitOrCheckMetaValue

oneflow/core/embedding/persistent_table.cpp:72–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void InitOrCheckMetaValue(const std::string& pathname, int64_t expected, bool init) {
73 bool exists = PosixFile::FileExists(pathname);
74 if (init) {
75 CHECK(!exists) << pathname;
76 std::ofstream ofs(pathname);
77 ofs << expected << std::endl;
78 } else {
79 CHECK(exists);
80 std::ifstream ifs(pathname);
81 int64_t value = 0;
82 ifs >> value;
83 if (value != expected) { LOG(FATAL) << "Check failed: " << pathname; }
84 }
85}
86
87std::string GetChunkName(uint64_t chunk_id) {
88 const std::string chunk_name_wo_leading_zero = std::to_string(chunk_id);

Callers 1

PersistentTableImplMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected