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

Function MakeMemCaseShared

oneflow/core/memory/memory_case_util.cpp:86–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86std::shared_ptr<MemoryCase> MakeMemCaseShared(const DeviceType device_type,
87 const int64_t device_id) {
88 auto mem_case_ptr = std::make_shared<MemoryCase>();
89 mem_case_ptr->set_device_type(device_type);
90 // We consider that there is only one cpu physical device.
91 // As non-cpu devices, a logical device map to a physical device,
92 // however as cpu devices, all logical devices map to a single physical device.
93 if (device_type == DeviceType::kCPU) {
94 mem_case_ptr->set_device_id(0);
95 } else {
96 mem_case_ptr->set_device_id(device_id);
97 }
98 return mem_case_ptr;
99}
100
101MemoryCase MakeHostMemCase() {
102 MemoryCase mem_case;

Callers 1

InitMethod · 0.85

Calls 1

set_device_typeMethod · 0.80

Tested by

no test coverage detected