• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2015 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 #ifndef TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_STREAM_UTIL_H_
17 #define TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_STREAM_UTIL_H_
18 
19 #include <unordered_map>
20 
21 #include "tensorflow/core/graph/graph.h"
22 #include "tensorflow/core/lib/core/status.h"
23 
24 namespace tensorflow {
25 namespace gpu_stream_util {
26 
27 struct AssignStreamsOpts {
28   int32 max_streams = 1;
29   // The following options specify a stream to use for specific op
30   // types.  The value -1 allows ops to be assigned to any stream.
31   int32 send_stream = -1;
32   int32 recv_stream = -1;
33   int32 const_stream = -1;
34   int32 compute_stream = -1;
35 };
36 
37 // Given the input graph, assigns every node in the graph with a
38 // stream_id that should be used.
39 Status AssignStreams(const Graph* graph, const AssignStreamsOpts& opts,
40                      std::unordered_map<int, int>* node_to_stream_id);
41 
42 }  // namespace gpu_stream_util
43 }  // namespace tensorflow
44 
45 #endif  // TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_STREAM_UTIL_H_
46