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

Function MakeScope

oneflow/core/framework/scope_util.cpp:44–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42} // namespace
43
44Maybe<Scope> MakeScope(const JobConfigProto& config_proto, const Device& device) {
45 std::shared_ptr<Scope> scope;
46 JUST(PhysicalRun([&](InstructionsBuilder* builder) -> Maybe<void> {
47 int64_t session_id = JUST(GetDefaultSessionId());
48 std::string device_tag = "cpu";
49 std::string machine_ids = "0";
50 std::string device_ids = "0";
51 if (device.type() != "cpu") {
52 device_tag = device.type();
53 device_ids = std::to_string(device.device_id());
54 }
55 scope = JUST(builder->BuildInitialScope(session_id, config_proto, device_tag,
56 {machine_ids + ":" + device_ids}, nullptr, false));
57 return Maybe<void>::Ok();
58 }));
59 return scope;
60}
61
62Maybe<Scope> MakeInitialScope(const JobConfigProto& job_conf, Symbol<ParallelDesc> placement,
63 bool is_local) {

Callers 2

MakeDefaultScopeFunction · 0.70
CompileScopeMethod · 0.50

Calls 6

PhysicalRunFunction · 0.85
GetDefaultSessionIdFunction · 0.85
to_stringFunction · 0.85
BuildInitialScopeMethod · 0.80
typeMethod · 0.45
device_idMethod · 0.45

Tested by

no test coverage detected