mxnet
libinfo.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
27 #pragma once
28 
29 #include <string>
30 #include <vector>
31 #include <array>
32 #include <memory>
33 #include "dmlc/base.h"
34 #include "mshadow/base.h"
35 #include "c_api.h"
36 
40 #ifndef MXNET_USE_OPENCV
41 #define MXNET_USE_OPENCV 0
42 #endif
43 
47 #ifndef MXNET_USE_CUDA
48 #define MXNET_USE_CUDA MSHADOW_USE_CUDA
49 #endif
50 
54 #ifndef MXNET_USE_CUDNN
55 #define MXNET_USE_CUDNN MSHADOW_USE_CUDNN
56 #endif
57 
58 #ifndef MXNET_USE_NCCL
59 #define MXNET_USE_NCCL 0
60 #endif
61 
65 #ifndef MXNET_USE_CUSOLVER
66 #define MXNET_USE_CUSOLVER MSHADOW_USE_CUSOLVER
67 #endif
68 
69 #ifndef MXNET_ENABLE_CUDA_RTC
70 #define MXNET_ENABLE_CUDA_RTC 0
71 #endif
72 
74 #define MXNET_GPU_NOT_ENABLED_ERROR "GPU is not enabled"
75 
76 
77 #ifndef MXNET_USE_TENSORRT
78 #define MXNET_USE_TENSORRT 0
79 #endif
80 
81 
82 #ifndef MXNET_USE_BLAS_ATLAS
83 #define MXNET_USE_BLAS_ATLAS 0
84 #endif
85 
86 #ifndef MXNET_USE_BLAS_OPEN
87 #define MXNET_USE_BLAS_OPEN 0
88 #endif
89 
90 #ifndef MXNET_USE_BLAS_MKL
91 #define MXNET_USE_BLAS_MKL 0
92 #endif
93 
94 #ifndef MXNET_USE_BLAS_APPLE
95 #define MXNET_USE_BLAS_APPLE 0
96 #endif
97 
98 #ifndef MXNET_USE_LAPACK
99 #define MXNET_USE_LAPACK 0
100 #endif
101 
102 #ifndef MXNET_USE_MKLDNN
103 #define MXNET_USE_MKLDNN 0
104 #endif
105 
106 #ifndef MXNET_USE_OPENMP
107 #define MXNET_USE_OPENMP 0
108 #endif
109 
110 #ifndef MXNET_USE_F16C
111 #define MXNET_USE_F16C MSHADOW_USE_F16C
112 #endif
113 
114 #ifndef MXNET_USE_CAFFE
115 #define MXNET_USE_CAFFE 0
116 #endif
117 
118 #ifndef MXNET_USE_DIST_KVSTORE
119 #define MXNET_USE_DIST_KVSTORE 0
120 #endif
121 
122 #ifndef MXNET_USE_SIGNAL_HANDLER
123 #define MXNET_USE_SIGNAL_HANDLER 0
124 #endif
125 
126 #ifndef MXNET_USE_INT64_TENSOR_SIZE
127 #define MXNET_USE_INT64_TENSOR_SIZE MSHADOW_INT64_TENSOR_SIZE
128 #endif
129 
130 #ifndef MXNET_USE_TVM_OP
131 #define MXNET_USE_TVM_OP 0
132 #endif
133 
134 namespace mxnet {
135 namespace features {
136 // Check compile flags such as CMakeLists.txt
137 
139 // ATTENTION: When changing this enum, match the strings in the implementation file!
140 enum : unsigned {
141  // NVIDIA, CUDA
142  CUDA = 0,
147 
148  // CPU Features / optimizations
154  CPU_SSE4A, // AMD extensions to SSE4
157 
158 
159  // Multiprocessing / CPU / System
164 
165  // Math libraries & BLAS
166  // Flavour of BLAS
169  // Intel(R) Math Kernel Library
172  // Other math libraries:
173  // Linear Algebra PACKage
175  // Intel(R) Math Kernel Library for Deep Neural Networks
177 
178  // Image processing
180 
181  // Misc
187 
188  // Signal handler to print stack traces on exceptions
191 
192  // TVM operator
194 
195  // size indicator
197 };
198 
199 
200 struct EnumNames {
201  static const std::vector<std::string> names;
202 };
203 
204 struct LibInfo {
205  LibInfo();
206  static LibInfo* getInstance();
207  const std::array<LibFeature, MAX_FEATURES>& getFeatures() {
208  return m_lib_features;
209  }
210  private:
211  std::array<LibFeature, MAX_FEATURES> m_lib_features;
212  static std::unique_ptr<LibInfo> m_inst;
213 };
214 
218 bool is_enabled(unsigned feat);
219 
220 } // namespace features
221 } // namespace mxnet
Definition: libinfo.h:163
Definition: libinfo.h:190
Definition: libinfo.h:156
Definition: libinfo.h:162
Definition: libinfo.h:167
Definition: libinfo.h:154
namespace of mxnet
Definition: api_registry.h:33
Definition: libinfo.h:144
Definition: libinfo.h:174
Definition: libinfo.h:153
Definition: libinfo.h:143
Definition: libinfo.h:186
Definition: libinfo.h:142
Definition: libinfo.h:171
Definition: libinfo.h:179
Definition: libinfo.h:146
Definition: libinfo.h:151
Definition: libinfo.h:168
bool is_enabled(unsigned feat)
Definition: libinfo.h:185
Definition: libinfo.h:189
Definition: libinfo.h:161
Definition: libinfo.h:149
Definition: libinfo.h:184
const std::array< LibFeature, MAX_FEATURES > & getFeatures()
Definition: libinfo.h:207
Definition: libinfo.h:145
Definition: libinfo.h:204
Definition: libinfo.h:183
Definition: libinfo.h:170
Definition: libinfo.h:152
Definition: libinfo.h:160
Definition: libinfo.h:200
Definition: libinfo.h:196
Definition: libinfo.h:155
Definition: libinfo.h:182
Definition: libinfo.h:176
Definition: libinfo.h:150
static const std::vector< std::string > names
Definition: libinfo.h:201
Definition: libinfo.h:193