TensorFlow Serving C++ API Documentation
resource_values.h
1 /* Copyright 2016 Google Inc. 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 // Standard values to describe resources, to be used for the string types in
17 // resources.proto. These values should be used whenever applicable, to avoid
18 // vocabulary mismatches.
19 
20 #ifndef TENSORFLOW_SERVING_RESOURCES_RESOURCE_VALUES_H_
21 #define TENSORFLOW_SERVING_RESOURCES_RESOURCE_VALUES_H_
22 
23 namespace tensorflow {
24 namespace serving {
25 
26 // Standard device types.
27 namespace device_types {
28 
29 // The primary devices such as CPU(s) and main memory, as well as aspects of the
30 // server as a whole.
31 extern const char* const kMain;
32 
33 // Graphics processing unit(s).
34 extern const char* const kGpu;
35 
36 // TPU(s).
37 extern const char* const kTpu;
38 
39 } // namespace device_types
40 
41 // Standard resource kinds.
42 namespace resource_kinds {
43 
44 // If a server can accommodate at most N models, depicted as the server having N
45 // "model slots", this is the number of slots needed or allocated.
46 extern const char* const kNumModelSlots;
47 
48 // If a server can accommodate at most N LoRA adapter models.
49 extern const char* const kNumLoraSlots;
50 
51 // RAM in bytes.
52 // NOTES:
53 // - For TPU or GPU device, The kHeapRamBytes and kStackRamBytes are aggregated
54 // to this kind.
55 // - In GPU device, this only represents the remaining RAM used for model
56 // variables and inference requests. Total GPU RAM includes remaining RAM and
57 // reserved RAM below.
58 extern const char* const kRamBytes;
59 
60 // Peak RAM in bytes, collected from Tcmalloc peak metric.
61 extern const char* const kPeakRamBytes;
62 
63 // RAM allocated on the heap.
64 extern const char* const kHeapRamBytes;
65 
66 // RAM reserved on the stack.
67 extern const char* const kStackRamBytes;
68 
69 // Only available for GPU device. Total reserved RAM used for compilation
70 // program and GPU system usage.
71 extern const char* const kReservedRamBytes;
72 
73 // Only available for GPU device. RAM reserved for GPU system usage.
74 extern const char* const kSystemRamBytes;
75 
76 // Only available for GPU device. The compilation program ram usage.
77 extern const char* const kModelBinaryRamBytes;
78 
79 // Fraction of a processing unit's cycles, in thousandths.
80 extern const char* const kProcessingMillis;
81 
82 } // namespace resource_kinds
83 
84 } // namespace serving
85 } // namespace tensorflow
86 
87 #endif // TENSORFLOW_SERVING_RESOURCES_RESOURCE_VALUES_H_