• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include "tensorflow/compiler/xla/service/gpu/gpu_executable_run_options.h"
17 
18 #include "absl/algorithm/container.h"
19 
20 namespace xla {
21 namespace gpu {
22 
NcclCliqueKey(std::vector<GlobalDeviceId> devices)23 NcclCliqueKey::NcclCliqueKey(std::vector<GlobalDeviceId> devices)
24     : devices_(std::move(devices)) {}
25 
ToString() const26 std::string NcclCliqueKey::ToString() const {
27   return GlobalDeviceIdsToString(devices_);
28 }
29 
set_gpu_global_device_ids(absl::optional<std::vector<GlobalDeviceId>> gpu_global_device_ids)30 GpuExecutableRunOptions& GpuExecutableRunOptions::set_gpu_global_device_ids(
31     absl::optional<std::vector<GlobalDeviceId>> gpu_global_device_ids) {
32   gpu_global_device_ids_ = std::move(gpu_global_device_ids);
33   return *this;
34 }
35 
36 const absl::optional<std::vector<GlobalDeviceId>>&
gpu_global_device_ids() const37 GpuExecutableRunOptions::gpu_global_device_ids() const {
38   return gpu_global_device_ids_;
39 }
40 
set_nccl_unique_id_callback(NcclUniqueIdCallback nccl_unique_id_callback)41 GpuExecutableRunOptions& GpuExecutableRunOptions::set_nccl_unique_id_callback(
42     NcclUniqueIdCallback nccl_unique_id_callback) {
43   nccl_unique_id_callback_ = std::move(nccl_unique_id_callback);
44   return *this;
45 }
46 
nccl_unique_id_callback() const47 const NcclUniqueIdCallback& GpuExecutableRunOptions::nccl_unique_id_callback()
48     const {
49   return nccl_unique_id_callback_;
50 }
51 
52 }  // namespace gpu
53 }  // namespace xla
54