Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Refine runtime feature discovery python API and add documentation to …
Browse files Browse the repository at this point in the history
…Python API docs
  • Loading branch information
Pedro Larroy committed Feb 12, 2019
1 parent 8a63bde commit 7a39b9a
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/api/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ Code examples are placed throughout the API documentation and these can be run a
rtc/rtc.md
```

## Run-Time Feature detection / Library Info

```eval_rst
.. toctree::
:maxdepth: 1
libinfo/libinfo.md
```



## Symbol API

```eval_rst
Expand Down
70 changes: 70 additions & 0 deletions docs/api/python/libinfo/libinfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Run-Time Feature detection / Library info

```eval_rst
.. currentmodule:: mxnet.runtime
```

## Overview

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

### Example usage

```python
In [1]: import mxnet as mx

In [2]: import mxnet.runtime

In [3]: mx.runtime.libinfo_features()
Out[3]:
[✔ 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]
```


```eval_rst
.. autosummary::
:nosignatures:
LibFeature
libinfo_features
```

## API Reference

<script type="text/javascript" src='../../../_static/js/auto_module_index.js'></script>

```eval_rst
.. automodule:: mxnet.runtime
:members:
```

<script>auto_index("api-reference");</script>
12 changes: 11 additions & 1 deletion python/mxnet/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ class LibFeature(ctypes.Structure):
Compile time feature description
"""
_fields_ = [
("name", ctypes.c_char_p),
("_name", ctypes.c_char_p),
("index", ctypes.c_uint32),
("enabled", ctypes.c_bool)
]

@property
def name(self):
return self._name.decode()

def __repr__(self):
if self.enabled:
return "✔ {}".format(self.name)
else:
return "✖ {}".format(self.name)

def libinfo_features():
"""
Check the library for compile-time features. The list of features are maintained in libinfo.h and libinfo.cc
Expand Down

0 comments on commit 7a39b9a

Please sign in to comment.