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 
26 #pragma once
27 
28 #include <string>
29 #include <vector>
30 #include <array>
31 #include <memory>
32 #include "dmlc/base.h"
33 #include "mshadow/base.h"
34 #include "c_api.h"
35 
39 #ifndef MXNET_USE_OPENCV
40 #define MXNET_USE_OPENCV 0
41 #endif
42 
46 #ifndef MXNET_USE_CUDA
47 #define MXNET_USE_CUDA MSHADOW_USE_CUDA
48 #endif
49 
53 #ifndef MXNET_USE_CUDNN
54 #define MXNET_USE_CUDNN MSHADOW_USE_CUDNN
55 #endif
56 
57 #ifndef MXNET_USE_NCCL
58 #define MXNET_USE_NCCL 0
59 #endif
60 
64 #ifndef MXNET_USE_CUSOLVER
65 #define MXNET_USE_CUSOLVER MSHADOW_USE_CUSOLVER
66 #endif
67 
68 #ifndef MXNET_ENABLE_CUDA_RTC
69 #define MXNET_ENABLE_CUDA_RTC 0
70 #endif
71 
73 #define MXNET_GPU_NOT_ENABLED_ERROR "GPU is not enabled"
74 
75 
76 #ifndef MXNET_USE_TENSORRT
77 #define MXNET_USE_TENSORRT 0
78 #endif
79 
80 
81 #ifndef MXNET_USE_BLAS_ATLAS
82 #define MXNET_USE_BLAS_ATLAS 0
83 #endif
84 
85 #ifndef MXNET_USE_BLAS_OPEN
86 #define MXNET_USE_BLAS_OPEN 0
87 #endif
88 
89 #ifndef MXNET_USE_BLAS_MKL
90 #define MXNET_USE_BLAS_MKL 0
91 #endif
92 
93 #ifndef MXNET_USE_BLAS_APPLE
94 #define MXNET_USE_BLAS_APPLE 0
95 #endif
96 
97 #ifndef MXNET_USE_LAPACK
98 #define MXNET_USE_LAPACK 0
99 #endif
100 
101 #ifndef MXNET_USE_MKLDNN
102 #define MXNET_USE_MKLDNN 0
103 #endif
104 
105 #ifndef MXNET_USE_OPENMP
106 #define MXNET_USE_OPENMP 0
107 #endif
108 
109 #ifndef MXNET_USE_F16C
110 #define MXNET_USE_F16C MSHADOW_USE_F16C
111 #endif
112 
113 #ifndef MXNET_USE_CAFFE
114 #define MXNET_USE_CAFFE 0
115 #endif
116 
117 #ifndef MXNET_USE_DIST_KVSTORE
118 #define MXNET_USE_DIST_KVSTORE 0
119 #endif
120 
121 #ifndef MXNET_USE_SIGNAL_HANDLER
122 #define MXNET_USE_SIGNAL_HANDLER 0
123 #endif
124 
125 #ifndef MXNET_USE_INT64_TENSOR_SIZE
126 #define MXNET_USE_INT64_TENSOR_SIZE MSHADOW_INT64_TENSOR_SIZE
127 #endif
128 
129 #ifndef MXNET_USE_TVM_OP
130 #define MXNET_USE_TVM_OP 0
131 #endif
132 
133 namespace mxnet {
134 namespace features {
135 // Check compile flags such as CMakeLists.txt
136 
138 // ATTENTION: When changing this enum, match the strings in the implementation file!
139 enum : unsigned {
140  // NVIDIA, CUDA
141  CUDA = 0,
146 
147  // CPU Features / optimizations
153  CPU_SSE4A, // AMD extensions to SSE4
156 
157 
158  // Multiprocessing / CPU / System
163 
164  // Math libraries & BLAS
165  // Flavour of BLAS
168  // Intel(R) Math Kernel Library
171  // Other math libraries:
172  // Linear Algebra PACKage
174  // Intel(R) Math Kernel Library for Deep Neural Networks
176 
177  // Image processing
179 
180  // Misc
186 
187  // Signal handler to print stack traces on exceptions
190 
191  // TVM operator
193 
194  // size indicator
196 };
197 
198 
199 struct EnumNames {
200  static const std::vector<std::string> names;
201 };
202 
203 struct LibInfo {
204  LibInfo();
205  static LibInfo* getInstance();
206  const std::array<LibFeature, MAX_FEATURES>& getFeatures() {
207  return m_lib_features;
208  }
209  private:
210  std::array<LibFeature, MAX_FEATURES> m_lib_features;
211  static std::unique_ptr<LibInfo> m_inst;
212 };
213 
217 bool is_enabled(unsigned feat);
218 
219 } // namespace features
220 } // namespace mxnet
Definition: libinfo.h:162
Definition: libinfo.h:189
Definition: libinfo.h:155
Definition: libinfo.h:161
Definition: libinfo.h:166
Definition: libinfo.h:153
namespace of mxnet
Definition: api_registry.h:33
Definition: libinfo.h:143
Definition: libinfo.h:173
Definition: libinfo.h:152
Definition: libinfo.h:142
Definition: libinfo.h:185
Definition: libinfo.h:141
Definition: libinfo.h:170
Definition: libinfo.h:178
Definition: libinfo.h:145
Definition: libinfo.h:150
Definition: libinfo.h:167
bool is_enabled(unsigned feat)
Definition: libinfo.h:184
Definition: libinfo.h:188
Definition: libinfo.h:160
Definition: libinfo.h:148
Definition: libinfo.h:183
const std::array< LibFeature, MAX_FEATURES > & getFeatures()
Definition: libinfo.h:206
Definition: libinfo.h:144
Definition: libinfo.h:203
Definition: libinfo.h:182
Definition: libinfo.h:169
Definition: libinfo.h:151
Definition: libinfo.h:159
Definition: libinfo.h:199
Definition: libinfo.h:195
Definition: libinfo.h:154
Definition: libinfo.h:181
Definition: libinfo.h:175
Definition: libinfo.h:149
static const std::vector< std::string > names
Definition: libinfo.h:200
Definition: libinfo.h:192