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 | #include "tensorflow/core/util/port.h" |
17 | |
18 | |
19 | namespace tensorflow { |
20 | |
21 | bool IsGoogleCudaEnabled() { |
22 | #if GOOGLE_CUDA |
23 | return true; |
24 | #else |
25 | return false; |
26 | #endif |
27 | } |
28 | |
29 | bool IsBuiltWithROCm() { |
30 | #if TENSORFLOW_USE_ROCM |
31 | return true; |
32 | #else |
33 | return false; |
34 | #endif |
35 | } |
36 | |
37 | bool IsBuiltWithXLA() { |
38 | #if TENSORFLOW_USE_XLA |
39 | return true; |
40 | #else |
41 | return false; |
42 | #endif |
43 | } |
44 | |
45 | bool IsBuiltWithNvcc() { |
46 | #if TENSORFLOW_USE_NVCC |
47 | return true; |
48 | #else |
49 | return false; |
50 | #endif |
51 | } |
52 | |
53 | bool GpuSupportsHalfMatMulAndConv() { |
54 | #if (defined(GOOGLE_CUDA) && GOOGLE_CUDA) || \ |
55 | (defined(TENSORFLOW_USE_ROCM) && TENSORFLOW_USE_ROCM) |
56 | return true; |
57 | #else |
58 | return false; |
59 | #endif |
60 | } |
61 | |
62 | bool IsMklEnabled() { |
63 | #if defined(INTEL_MKL) && defined(ENABLE_MKL) |
64 | return true; |
65 | #else |
66 | return false; |
67 | #endif // INTEL_MKL && ENABLE_MKL |
68 | } |
69 | } // end namespace tensorflow |
70 | |