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_CUTENSOR
58 #define MXNET_USE_CUTENSOR MSHADOW_USE_CUTENSOR
59 #endif
60 
61 #ifndef MXNET_USE_NVML
62 #define MXNET_USE_NVML 0
63 #endif
64 
65 #ifndef MXNET_USE_NCCL
66 #define MXNET_USE_NCCL 0
67 #endif
68 
72 #ifndef MXNET_USE_CUSOLVER
73 #define MXNET_USE_CUSOLVER MSHADOW_USE_CUSOLVER
74 #endif
75 
77 #define MXNET_GPU_NOT_ENABLED_ERROR "GPU is not enabled"
78 
79 #ifndef MXNET_USE_TENSORRT
80 #define MXNET_USE_TENSORRT 0
81 #endif
82 
83 #ifndef MXNET_USE_BLAS_ATLAS
84 #define MXNET_USE_BLAS_ATLAS 0
85 #endif
86 
87 #ifndef MXNET_USE_BLAS_OPEN
88 #define MXNET_USE_BLAS_OPEN 0
89 #endif
90 
91 #ifndef MXNET_USE_BLAS_MKL
92 #define MXNET_USE_BLAS_MKL 0
93 #endif
94 
95 #ifndef MXNET_USE_BLAS_APPLE
96 #define MXNET_USE_BLAS_APPLE 0
97 #endif
98 
99 #ifndef MXNET_USE_LAPACK
100 #define MXNET_USE_LAPACK 0
101 #endif
102 
103 #ifndef MXNET_USE_ONEDNN
104 #define MXNET_USE_ONEDNN 0
105 #endif
106 
107 #ifndef MXNET_USE_OPENMP
108 #define MXNET_USE_OPENMP 0
109 #endif
110 
111 #ifndef MXNET_USE_F16C
112 #define MXNET_USE_F16C MSHADOW_USE_F16C
113 #endif
114 
115 #ifndef MXNET_USE_DIST_KVSTORE
116 #define MXNET_USE_DIST_KVSTORE 0
117 #endif
118 
119 #ifndef MXNET_USE_SIGNAL_HANDLER
120 #define MXNET_USE_SIGNAL_HANDLER 0
121 #endif
122 
123 #ifndef MXNET_USE_INT64_TENSOR_SIZE
124 #define MXNET_USE_INT64_TENSOR_SIZE MSHADOW_INT64_TENSOR_SIZE
125 #endif
126 
127 #ifndef MXNET_USE_TVM_OP
128 #define MXNET_USE_TVM_OP 0
129 #endif
130 
131 namespace mxnet {
132 namespace features {
133 // Check compile flags such as CMakeLists.txt
134 
136 // ATTENTION: When changing this enum, match the strings in the implementation file!
137 enum : unsigned {
138  // NVIDIA, CUDA
139  CUDA = 0,
144 
145  // CPU Features / optimizations
151  CPU_SSE4A, // AMD extensions to SSE4
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  // oneAPI Deep Neural Network Library (oneDNN)
173 
174  // Image processing
176 
177  // Misc
180 
181  // Signal handler to print stack traces on exceptions
184 
185  // TVM operator
187 
188  // size indicator
190 };
191 
192 struct EnumNames {
193  static const std::vector<std::string> names;
194 };
195 
196 struct LibInfo {
197  LibInfo();
198  static LibInfo* getInstance();
199  const std::array<LibFeature, MAX_FEATURES>& getFeatures() {
200  return m_lib_features;
201  }
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
mxnet
namespace of mxnet
Definition: api_registry.h:33
mxnet::features::TENSORRT
@ TENSORRT
Definition: libinfo.h:142
mxnet::features::DEBUG
@ DEBUG
Definition: libinfo.h:183
mxnet::features::DIST_KVSTORE
@ DIST_KVSTORE
Definition: libinfo.h:178
mxnet::features::MAX_FEATURES
@ MAX_FEATURES
Definition: libinfo.h:189
mxnet::features::BLAS_APPLE
@ BLAS_APPLE
Definition: libinfo.h:167
mxnet::features::CPU_AVX2
@ CPU_AVX2
Definition: libinfo.h:153
mxnet::features::BLAS_MKL
@ BLAS_MKL
Definition: libinfo.h:166
mxnet::features::CUTENSOR
@ CUTENSOR
Definition: libinfo.h:143
base.h
defines configuration macros
mxnet::features::F16C
@ F16C
Definition: libinfo.h:158
mxnet::features::OPENCV
@ OPENCV
Definition: libinfo.h:175
mxnet::features::CUDA
@ CUDA
Definition: libinfo.h:139
mxnet::features::LibInfo::getFeatures
const std::array< LibFeature, MAX_FEATURES > & getFeatures()
Definition: libinfo.h:199
mxnet::features::CPU_SSE
@ CPU_SSE
Definition: libinfo.h:146
mxnet::features::ONEDNN
@ ONEDNN
Definition: libinfo.h:172
mxnet::features::CPU_SSE3
@ CPU_SSE3
Definition: libinfo.h:148
mxnet::features::TVM_OP
@ TVM_OP
Definition: libinfo.h:186
mxnet::features::CPU_SSE2
@ CPU_SSE2
Definition: libinfo.h:147
mxnet::features::SSE
@ SSE
Definition: libinfo.h:157
mxnet::features::CPU_SSE4A
@ CPU_SSE4A
Definition: libinfo.h:151
mxnet::features::LibInfo::getInstance
static LibInfo * getInstance()
mxnet::features::JEMALLOC
@ JEMALLOC
Definition: libinfo.h:159
mxnet::features::SIGNAL_HANDLER
@ SIGNAL_HANDLER
Definition: libinfo.h:182
c_api.h
C API of mxnet.
mxnet::features::is_enabled
bool is_enabled(unsigned feat)
mxnet::features::LibInfo::LibInfo
LibInfo()
mxnet::features::CPU_AVX
@ CPU_AVX
Definition: libinfo.h:152
mxnet::features::INT64_TENSOR_SIZE
@ INT64_TENSOR_SIZE
Definition: libinfo.h:179
mxnet::features::CUDNN
@ CUDNN
Definition: libinfo.h:140
mxnet::features::EnumNames::names
static const std::vector< std::string > names
Definition: libinfo.h:193
mxnet::features::NCCL
@ NCCL
Definition: libinfo.h:141
mxnet::features::BLAS_OPEN
@ BLAS_OPEN
Definition: libinfo.h:163
mxnet::features::LibInfo
Definition: libinfo.h:196
mxnet::features::EnumNames
Definition: libinfo.h:192
mxnet::features::OPENMP
@ OPENMP
Definition: libinfo.h:156
mxnet::features::CPU_SSE4_2
@ CPU_SSE4_2
Definition: libinfo.h:150
mxnet::features::BLAS_ATLAS
@ BLAS_ATLAS
Definition: libinfo.h:164
base.h
definitions of base types, operators, macros functions
mxnet::features::CPU_SSE4_1
@ CPU_SSE4_1
Definition: libinfo.h:149
mxnet::features::LAPACK
@ LAPACK
Definition: libinfo.h:170