MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsMultiDevice

Function IsMultiDevice

tensorflow/core/common_runtime/eager/execute.cc:321–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321bool IsMultiDevice(const FunctionDef* fdef) {
322 if (fdef == nullptr) {
323 // Primitive op.
324 return false;
325 }
326
327 // Run all functions as multi-device.
328 return true;
329
330 // We can eliminate some overhead by running simple functions using regular
331 // CallOp kernel. However, it is tricky to figure out which functions should
332 // be run using CallOp. Also, currently CallOp runs neither optimization
333 // passes (needed for TPU/XLA) nor grappler.
334 // Here are some cases where a function should be run in multi-device mode:
335 // - Function takes at least two resources on different devices.
336 // - Function takes a resource on deviceA and a body op explicitly placed
337 // on deviceB.
338 // - Function has a colocation constraint.
339 // - Function has an explicit device annotation (which might not be using
340 // full canonical device name) different from op_device. Note that false
341 // positives are ok.
342 // - Function has a node or a (node) attribute that can potentially make
343 // the function multi-device after a rewrite pass (e.g. various XLA/TPU
344 // special nodes and attributes)
345}
346
347Status GetDeviceForInput(const EagerContext* ctx, TensorHandle* tensor_handle,
348 Device** result) {

Callers 4

GetOutputDevicesMethod · 0.85
RunMultiDeviceMethod · 0.85
ReleaseHandleMethod · 0.85
EagerLocalExecuteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected