static */
| 45 | namespace xla { |
| 46 | |
| 47 | /* static */ StatusOr<std::unique_ptr<LocalService>> LocalService::NewService( |
| 48 | const ServiceOptions& options) { |
| 49 | se::Platform* platform = options.platform(); |
| 50 | if (platform == nullptr) { |
| 51 | TF_ASSIGN_OR_RETURN(platform, PlatformUtil::GetDefaultPlatform()); |
| 52 | } |
| 53 | |
| 54 | BackendOptions backend_options; |
| 55 | backend_options.set_platform(platform) |
| 56 | .set_intra_op_parallelism_threads(options.intra_op_parallelism_threads()) |
| 57 | .set_allowed_devices(options.allowed_devices()); |
| 58 | |
| 59 | TF_ASSIGN_OR_RETURN(std::unique_ptr<Backend> backend, |
| 60 | Backend::CreateBackend(backend_options)); |
| 61 | |
| 62 | std::unique_ptr<LocalService> service( |
| 63 | new LocalService(options, std::move(backend))); |
| 64 | return std::move(service); |
| 65 | } |
| 66 | |
| 67 | LocalService::LocalService(const ServiceOptions& options, |
| 68 | std::unique_ptr<Backend> execute_backend) |
nothing calls this directly
no test coverage detected