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

Function CompleteEnvProto

oneflow/api/cpp/env_impl.cpp:93–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void CompleteEnvProto(of::EnvProto& env_proto) {
94 auto bootstrap_conf = env_proto.mutable_ctrl_bootstrap_conf();
95 auto master_addr = bootstrap_conf->mutable_master_addr();
96 const std::string addr = GetEnvVar("MASTER_ADDR", "127.0.0.1");
97 master_addr->set_host(addr);
98 master_addr->set_port(GetEnvVar("MASTER_PORT", FindFreePort(addr)));
99 bootstrap_conf->set_world_size(GetEnvVar("WORLD_SIZE", 1));
100 bootstrap_conf->set_rank(GetEnvVar("RANK", 0));
101
102 auto cpp_logging_conf = env_proto.mutable_cpp_logging_conf();
103 if (HasEnvVar("GLOG_log_dir")) { cpp_logging_conf->set_log_dir(GetEnvVar("GLOG_log_dir", "")); }
104 if (HasEnvVar("GLOG_logtostderr")) {
105 cpp_logging_conf->set_logtostderr(GetEnvVar("GLOG_logtostderr", -1));
106 }
107 if (HasEnvVar("GLOG_logbuflevel")) {
108 cpp_logging_conf->set_logbuflevel(GetEnvVar("GLOG_logbuflevel", -1));
109 }
110 if (HasEnvVar("GLOG_minloglevel")) {
111 cpp_logging_conf->set_minloglevel(GetEnvVar("GLOG_minloglevel", -1));
112 }
113}
114} // namespace
115
116OneFlowEnv::OneFlowEnv() {

Callers 1

OneFlowEnvMethod · 0.70

Calls 3

GetEnvVarFunction · 0.85
FindFreePortFunction · 0.85
HasEnvVarFunction · 0.85

Tested by

no test coverage detected