| 777 | } |
| 778 | |
| 779 | Status 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 | |
| 803 | StatusOr<std::unique_ptr<Executable>> Service::BuildExecutable( |
| 804 | const HloModuleProto& module_proto, |
nothing calls this directly
no test coverage detected