• 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/core/tpu/tpu_configuration.h"
17 
18 namespace tensorflow {
19 
20 namespace {
21 
GetGlobalResourceMgr()22 ResourceMgr* GetGlobalResourceMgr() {
23   static ResourceMgr* const rmgr = new ResourceMgr();
24   return rmgr;
25 }
26 
27 }  // namespace
28 
29 #if !defined(PLATFORM_GOOGLE)
30 // Used only by Google-internal tests, so deliberately left empty.
MaybeInitializeTPUSystemForTests()31 void MaybeInitializeTPUSystemForTests() {}
32 #endif
33 
GetTPUConfigResourceMgr()34 ResourceMgr* GetTPUConfigResourceMgr() {
35   MaybeInitializeTPUSystemForTests();
36 
37   // Put all TPU-related state in the global ResourceMgr. This includes the
38   // TpuPodState, compilation cache, etc. We don't use the TPU_SYSTEM
39   // ResourceMgr because there may be more than one TPU_SYSTEM ResourceMgr when
40   // DirectSession or isolate_session_state are used.
41   return GetGlobalResourceMgr();
42 }
43 
44 }  // namespace tensorflow
45