From f9dc7f460cb0fc4c0c77a0fd505d3ba6a6aa4126 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Tue, 19 Feb 2019 15:03:02 +0100 Subject: [PATCH 1/5] minor: Refine documentation --- docs/api/python/libinfo/libinfo.md | 3 --- python/mxnet/runtime.py | 23 ++++++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/api/python/libinfo/libinfo.md b/docs/api/python/libinfo/libinfo.md index 531e1ced3c99..032230c968f6 100644 --- a/docs/api/python/libinfo/libinfo.md +++ b/docs/api/python/libinfo/libinfo.md @@ -52,9 +52,6 @@ In [6]: .. autosummary:: :nosignatures: - Features - Feature - feature_list ``` ## API Reference diff --git a/python/mxnet/runtime.py b/python/mxnet/runtime.py index 7ef5e1943072..d660e77534cd 100644 --- a/python/mxnet/runtime.py +++ b/python/mxnet/runtime.py @@ -27,17 +27,27 @@ class Feature(ctypes.Structure): """ - Compile time feature description + Compile time feature description, member fields: `name` and `enabled`. """ _fields_ = [ ("_name", ctypes.c_char_p), - ("enabled", ctypes.c_bool) + ("_enabled", ctypes.c_bool) ] @property def name(self): + """ + feature name + """ return self._name.decode() + @property + def enabled(self): + """ + True if MXNet was compiled with the given compile-time feature + """ + return self._enabled + def __repr__(self): if self.enabled: return "✔ {}".format(self.name) @@ -50,7 +60,8 @@ def feature_list(): Returns ------- - :return: list of class LibFeature indicating which features are available and enabled + list + List of :class:`.Feature` objects """ lib_features_c_array = ctypes.POINTER(Feature)() lib_features_size = ctypes.c_size_t() @@ -74,11 +85,13 @@ def is_enabled(self, feature_name): Parameters ---------- - :param x: str The name of a valid feature as string for example 'CUDA' + feature_name: str + The name of a valid feature as string for example 'CUDA' Returns ------- - :return: bool True if it's enabled, False if it's disabled, RuntimeError if the feature is not known + Boolean + True if it's enabled, False if it's disabled, RuntimeError if the feature is not known """ feature_name = feature_name.upper() if feature_name not in self: From dcf581164f4de2b7a8003e0e0ce3b1a0f155b21a Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Mon, 25 Feb 2019 20:36:53 +0100 Subject: [PATCH 2/5] Update python/mxnet/runtime.py Co-Authored-By: larroy --- python/mxnet/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mxnet/runtime.py b/python/mxnet/runtime.py index d660e77534cd..91db87a84d52 100644 --- a/python/mxnet/runtime.py +++ b/python/mxnet/runtime.py @@ -37,7 +37,7 @@ class Feature(ctypes.Structure): @property def name(self): """ - feature name + Feature name. """ return self._name.decode() From 512db19c0132316de21fb71139692469c8a33af5 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Mon, 25 Feb 2019 20:37:03 +0100 Subject: [PATCH 3/5] Update python/mxnet/runtime.py Co-Authored-By: larroy --- python/mxnet/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mxnet/runtime.py b/python/mxnet/runtime.py index 91db87a84d52..e47cca93dace 100644 --- a/python/mxnet/runtime.py +++ b/python/mxnet/runtime.py @@ -44,7 +44,7 @@ def name(self): @property def enabled(self): """ - True if MXNet was compiled with the given compile-time feature + True if MXNet was compiled with the given compile-time feature. """ return self._enabled From a26aee52c37797578744325da78c74fc65040a91 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Tue, 26 Feb 2019 10:29:21 +0100 Subject: [PATCH 4/5] Address CR comment --- docs/api/python/libinfo/libinfo.md | 73 ++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/docs/api/python/libinfo/libinfo.md b/docs/api/python/libinfo/libinfo.md index 032230c968f6..8767ae719838 100644 --- a/docs/api/python/libinfo/libinfo.md +++ b/docs/api/python/libinfo/libinfo.md @@ -28,23 +28,68 @@ The libinfo functionality allows to check for compile-time features supported by ### Example usage ``` -In [1]: import mxnet as mx +In []: import mxnet as mx ...: import mxnet.runtime ...: fs = mx.runtime.Features() -In [2]: fs -Out[2]: [✖ 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 [3]: fs['CUDA'].enabled -Out[3]: False - -In [4]: fs.is_enabled('CPU_SSE') -Out[4]: True - -In [5]: fs.is_enabled('CUDA') -Out[5]: False - -In [6]: +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 ``` From bce98bb0f18c27ad1b0c4b0cfbc691d603bd6cc3 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Wed, 27 Feb 2019 12:19:15 +0100 Subject: [PATCH 5/5] retrigger CI --- docs/api/python/libinfo/libinfo.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/api/python/libinfo/libinfo.md b/docs/api/python/libinfo/libinfo.md index 8767ae719838..3b8d4998aa5b 100644 --- a/docs/api/python/libinfo/libinfo.md +++ b/docs/api/python/libinfo/libinfo.md @@ -92,7 +92,6 @@ In []: type(features[0]) Out[]: mxnet.runtime.Feature ``` - ```eval_rst .. autosummary:: :nosignatures: