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

Method OneFlowEnv

oneflow/api/cpp/env_impl.cpp:116–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114} // namespace
115
116OneFlowEnv::OneFlowEnv() {
117 of::EnvProto env_proto;
118 CompleteEnvProto(env_proto);
119
120 env_ctx_ = std::make_shared<of::EnvGlobalObjectsScope>(env_proto);
121
122 of::ConfigProto config_proto;
123 config_proto.mutable_resource()->set_cpu_device_num(1); // useless, will be set in TryInit
124 const int64_t session_id = of::NewSessionId();
125 config_proto.set_session_id(session_id);
126 CHECK(of::RegsterSessionId(session_id));
127 session_ctx_ = std::make_shared<of::MultiClientSessionContext>(env_ctx_);
128 CHECK_JUST(session_ctx_->TryInit(config_proto));
129}
130
131OneFlowEnv::~OneFlowEnv() {
132 session_ctx_.reset();

Callers

nothing calls this directly

Calls 4

NewSessionIdFunction · 0.85
RegsterSessionIdFunction · 0.85
CompleteEnvProtoFunction · 0.70
TryInitMethod · 0.45

Tested by

no test coverage detected