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 namespace mxnet {
131 namespace features {
132 // Check compile flags such as CMakeLists.txt
133 
135 // ATTENTION: When changing this enum, match the strings in the implementation file!
136 enum : unsigned {
137  // NVIDIA, CUDA
138  CUDA = 0,
143 
144  // CPU Features / optimizations
150  CPU_SSE4A, // AMD extensions to SSE4
153 
154 
155  // Multiprocessing / CPU / System
160 
161  // Math libraries & BLAS
162  // Flavour of BLAS
165  // Intel(R) Math Kernel Library
168  // Other math libraries:
169  // Linear Algebra PACKage
171  // Intel(R) Math Kernel Library for Deep Neural Networks
173 
174  // Image processing
176 
177  // Misc
183 
184  // Signal handler to print stack traces on exceptions
187 
188  // size indicator
190 };
191 
192 
193 struct EnumNames {
194  static const std::vector<std::string> names;
195 };
196 
197 struct LibInfo {
198  LibInfo();
199  static LibInfo* getInstance();
200  const std::array<LibFeature, MAX_FEATURES>& getFeatures() {
201  return m_lib_features;
202  }
203  private:
204  std::array<LibFeature, MAX_FEATURES> m_lib_features;
205  static std::unique_ptr<LibInfo> m_inst;
206 };
207 
211 bool is_enabled(unsigned feat);
212 
213 } // namespace features
214 } // namespace mxnet
C API of mxnet.
Definition: libinfo.h:159
Definition: libinfo.h:186
Definition: libinfo.h:152
Definition: libinfo.h:158
Definition: libinfo.h:163
Definition: libinfo.h:150
namespace of mxnet
Definition: base.h:89
Definition: libinfo.h:140
Definition: libinfo.h:170
Definition: libinfo.h:149
Definition: libinfo.h:139
Definition: libinfo.h:182
Definition: libinfo.h:138
Definition: libinfo.h:167
Definition: libinfo.h:175
Definition: libinfo.h:142
Definition: libinfo.h:147
Definition: libinfo.h:164
bool is_enabled(unsigned feat)
Definition: libinfo.h:181
Definition: libinfo.h:185
Definition: libinfo.h:157
Definition: libinfo.h:145
Definition: libinfo.h:180
const std::array< LibFeature, MAX_FEATURES > & getFeatures()
Definition: libinfo.h:200
Definition: libinfo.h:141
Definition: libinfo.h:197
Definition: libinfo.h:179
Definition: libinfo.h:166
Definition: libinfo.h:148
Definition: libinfo.h:156
Definition: libinfo.h:193
Definition: libinfo.h:189
Definition: libinfo.h:151
Definition: libinfo.h:178
Definition: libinfo.h:172
Definition: libinfo.h:146
static const std::vector< std::string > names
Definition: libinfo.h:194