Run-Time Feature detection / Library info

Overview

The libinfo functionality allows to check for compile-time features supported by the library.

Example usage

In []: import mxnet as mx
   ...: import mxnet.runtime
   ...: fs = mx.runtime.Features()

In []: fs
Out[]: [✖ CUDA, ✖ CUDNN, ✖ NCCL, ✖ CUDA_RTC, ✖ TENSORRT, ✔ CPU_SSE, ✔ CPU_SSE2, ✔ CPU_SSE3, ✔ CPU_SSE4_1, ✔ CPU_SSE4_2, ✖ CPU_SSE4A, ✔ CPU_AVX, ✖ CPU_AVX2, ✖ OPENMP, ✖ SSE, ✔ F16C, ✖ JEMALLOC, ✔ BLAS_OPEN, ✖ BLAS_ATLAS, ✖ BLAS_MKL, ✖ BLAS_APPLE, ✔ LAPACK, ✖ MKLDNN, ✔ OPENCV, ✖ CAFFE, ✖ PROFILER, ✖ DIST_KVSTORE, ✖ CXX14, ✔ SIGNAL_HANDLER, ✔ DEBUG]

In []: fs.keys()
Out[]: odict_keys(['CUDA', 'CUDNN', 'NCCL', 'CUDA_RTC', 'TENSORRT', 'CPU_SSE', 'CPU_SSE2', 'CPU_SSE3', 'CPU_SSE4_1', 'CPU_SSE4_2', 'CPU_SSE4A', 'CPU_AVX', 'CPU_AVX2', 'OPENMP', 'SSE', 'F16C', 'JEMALLOC', 'BLAS_OPEN', 'BLAS_ATLAS', 'BLAS_MKL', 'BLAS_APPLE', 'LAPACK', 'MKLDNN', 'OPENCV', 'CAFFE', 'PROFILER', 'DIST_KVSTORE', 'CXX14', 'SIGNAL_HANDLER', 'DEBUG'])

In []: type(fs['CUDA'])
Out[]: mxnet.runtime.Feature

In []: fs['CUDA'].enabled
Out[]: False

In []: fs.is_enabled('CPU_SSE')
Out[]: True

In []: fs.is_enabled('CUDA')
Out[]: False

In []: features = mx.runtime.feature_list()

In []: features
Out[]:
[✖ CUDA,
 ✖ CUDNN,
 ✖ NCCL,
 ✖ CUDA_RTC,
 ✖ TENSORRT,
 ✔ CPU_SSE,
 ✔ CPU_SSE2,
 ✔ CPU_SSE3,
 ✔ CPU_SSE4_1,
 ✔ CPU_SSE4_2,
 ✖ CPU_SSE4A,
 ✔ CPU_AVX,
 ✖ CPU_AVX2,
 ✖ OPENMP,
 ✖ SSE,
 ✔ F16C,
 ✖ JEMALLOC,
 ✔ BLAS_OPEN,
 ✖ BLAS_ATLAS,
 ✖ BLAS_MKL,
 ✖ BLAS_APPLE,
 ✔ LAPACK,
 ✖ MKLDNN,
 ✔ OPENCV,
 ✖ CAFFE,
 ✖ PROFILER,
 ✖ DIST_KVSTORE,
 ✖ CXX14,
 ✔ SIGNAL_HANDLER,
 ✔ DEBUG]

In []: type(features)
Out[]: list

In []: type(features[0])
Out[]: mxnet.runtime.Feature

API Reference

runtime querying of compile time features in the native library

class mxnet.runtime.Feature[source]

Compile time feature description, member fields: name and enabled.

name

Feature name.

enabled

True if MXNet was compiled with the given compile-time feature.

mxnet.runtime.feature_list()[source]

Check the library for compile-time features. The list of features are maintained in libinfo.h and libinfo.cc

Returns:List of Feature objects
Return type:list
class mxnet.runtime.Features[source]

OrderedDict of name to Feature

is_enabled(feature_name)[source]

Check for a particular feature by name

Parameters:feature_name (str) – The name of a valid feature as string for example ‘CUDA’
Returns:True if it’s enabled, False if it’s disabled, RuntimeError if the feature is not known
Return type:Boolean