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

Method GetDeviceHandles

tensorflow/compiler/xla/service/service.cc:779–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777}
778
779Status Service::GetDeviceHandles(const GetDeviceHandlesRequest* arg,
780 GetDeviceHandlesResponse* result) {
781 const int64 available_device_count = execute_backend_->device_count();
782 const int64 replica_count = options_.number_of_replicas();
783 if (replica_count <= 0) {
784 return FailedPrecondition("Replica count must be a positive integer");
785 }
786 if (available_device_count < arg->device_count() * replica_count) {
787 return ResourceExhausted(
788 "Requested logical device count (%d) with replica count (%d) exceeds "
789 "the number of available physical devices on the target (%d)",
790 arg->device_count(), replica_count, available_device_count);
791 }
792
793 for (int64 i = 0; i < arg->device_count(); ++i) {
794 DeviceHandle device_handle;
795 device_handle.set_handle(i);
796 device_handle.set_device_count(arg->device_count());
797 *result->add_device_handles() = device_handle;
798 }
799
800 return Status::OK();
801}
802
803StatusOr<std::unique_ptr<Executable>> Service::BuildExecutable(
804 const HloModuleProto& module_proto,

Callers

nothing calls this directly

Calls 5

FailedPreconditionFunction · 0.85
ResourceExhaustedFunction · 0.85
device_countMethod · 0.45
number_of_replicasMethod · 0.45
set_handleMethod · 0.45

Tested by

no test coverage detected