You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2021/03/24 12:21:43 UTC

[incubator-mxnet] branch master updated: Fix oneDNN feature name in MxNET (#20070)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 626f933  Fix oneDNN feature name in MxNET (#20070)
626f933 is described below

commit 626f933687a20a6e55edb4b74a6fce1e13b31624
Author: bartekkuncer <ba...@intel.com>
AuthorDate: Wed Mar 24 13:20:08 2021 +0100

    Fix oneDNN feature name in MxNET (#20070)
---
 cd/utils/artifact_repository.py       |  4 ++--
 cd/utils/test_artifact_repository.py  | 14 +++++++-------
 include/mxnet/libinfo.h               |  4 ++--
 python/mxnet/amp/lists/symbol_fp16.py |  2 +-
 python/mxnet/runtime.py               |  2 +-
 src/libinfo.cc                        |  4 ++--
 tools/dependencies/README.md          |  6 +++---
 tools/pip/setup.py                    |  6 +++---
 8 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/cd/utils/artifact_repository.py b/cd/utils/artifact_repository.py
index dd10a4b..6234ac9 100644
--- a/cd/utils/artifact_repository.py
+++ b/cd/utils/artifact_repository.py
@@ -291,7 +291,7 @@ def probe_cpu_variant(mxnet_features: Dict[str, bool]) -> str:
     :return: Either cpu, or mkl as the variant
     """
     logger.debug('Determining cpu variant')
-    if not mxnet_features['MKLDNN']:
+    if not mxnet_features['ONEDNN']:
         logger.debug('variant is: native')
         return 'native'
 
@@ -312,7 +312,7 @@ def probe_gpu_variant(mxnet_features: Dict[str, bool]) -> Optional[str]:
     cuda_version = get_cuda_version()
     if cuda_version:
         variant = 'cu{}'.format(cuda_version)
-        if not mxnet_features['MKLDNN']:
+        if not mxnet_features['ONEDNN']:
             RuntimeError('Error determining mxnet variant: ONEDNN should be enabled for cuda variants')
         logger.debug('variant is: {}'.format(variant))
         return variant
diff --git a/cd/utils/test_artifact_repository.py b/cd/utils/test_artifact_repository.py
index ca8724b..a3f0444 100644
--- a/cd/utils/test_artifact_repository.py
+++ b/cd/utils/test_artifact_repository.py
@@ -161,26 +161,26 @@ class TestArtifactRepositoryTool(unittest.TestCase):
     @patch('artifact_repository.get_libmxnet_features')
     def test_probe_variant_native(self, mock_features):
         """
-        Tests 'native' is returned if MKLDNN and CUDA features are OFF
+        Tests 'native' is returned if ONEDNN and CUDA features are OFF
         """
-        mock_features.return_value = {'MKLDNN': False, 'CUDA': False}
+        mock_features.return_value = {'ONEDNN': False, 'CUDA': False}
         self.assertEqual(probe_mxnet_variant('libmxnet.so'), 'native')
 
     @patch('artifact_repository.get_libmxnet_features')
     def test_probe_variant_cpu(self, mock_features):
         """
-        Tests 'cpu' is returned if MKLDNN is ON and CUDA is OFF
+        Tests 'cpu' is returned if ONEDNN is ON and CUDA is OFF
         """
-        mock_features.return_value = {'MKLDNN': True, 'CUDA': False}
+        mock_features.return_value = {'ONEDNN': True, 'CUDA': False}
         self.assertEqual(probe_mxnet_variant('libmxnet.so'), 'cpu')
 
     @patch('artifact_repository.get_libmxnet_features')
     @patch('artifact_repository.get_cuda_version')
     def test_probe_variant_cuda(self, mock_cuda_version, mock_features):
         """
-        Tests 'cu102' is returned if MKLDNN is OFF and CUDA is ON and CUDA version is 10.2
+        Tests 'cu102' is returned if ONEDNN is OFF and CUDA is ON and CUDA version is 10.2
         """
-        mock_features.return_value = {'MKLDNN': True, 'CUDA': True}
+        mock_features.return_value = {'ONEDNN': True, 'CUDA': True}
         mock_cuda_version.return_value = '102'
         self.assertEqual(probe_mxnet_variant('libmxnet.so'), 'cu102')
 
@@ -198,7 +198,7 @@ class TestArtifactRepositoryTool(unittest.TestCase):
         """
         Tests exception is raised if CUDA feature is ON but cuda version could not be determined
         """
-        mock_features.return_value = {'MKLDNN': True, 'CUDA': True}
+        mock_features.return_value = {'ONEDNN': True, 'CUDA': True}
         mock_cuda_version.return_value = None
         with self.assertRaises(RuntimeError):
             probe_mxnet_variant('libmxnet.so')
diff --git a/include/mxnet/libinfo.h b/include/mxnet/libinfo.h
index 6eee0a9..4282e24 100644
--- a/include/mxnet/libinfo.h
+++ b/include/mxnet/libinfo.h
@@ -172,8 +172,8 @@ enum : unsigned {
   // Other math libraries:
   // Linear Algebra PACKage
   LAPACK,
-  // Intel(R) Math Kernel Library for Deep Neural Networks
-  MKLDNN,
+  // oneAPI Deep Neural Network Library (oneDNN)
+  ONEDNN,
 
   // Image processing
   OPENCV,
diff --git a/python/mxnet/amp/lists/symbol_fp16.py b/python/mxnet/amp/lists/symbol_fp16.py
index d58237b..f78d32d 100644
--- a/python/mxnet/amp/lists/symbol_fp16.py
+++ b/python/mxnet/amp/lists/symbol_fp16.py
@@ -600,7 +600,7 @@ FP32_FUNCS = [
     '_contrib_sldwin_atten_context',
     ]
 
-if Features().is_enabled('MKLDNN'):
+if Features().is_enabled('ONEDNN'):
     FP32_FUNCS.extend([
         '_sg_mkldnn_conv',
         '_sg_mkldnn_fully_connected',
diff --git a/python/mxnet/runtime.py b/python/mxnet/runtime.py
index a8cac42..9fda81e 100644
--- a/python/mxnet/runtime.py
+++ b/python/mxnet/runtime.py
@@ -40,7 +40,7 @@ Example usage:
     [✖ CUDA, ✖ CUDNN, ✖ NCCL, ✖ 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, ✖ DIST_KVSTORE, ✖ INT64_TENSOR_SIZE, ✔ SIGNAL_HANDLER, ✔ DEBUG, ✖ TVM_OP]
+    ✖ ONEDNN, ✔ OPENCV, ✖ DIST_KVSTORE, ✖ INT64_TENSOR_SIZE, ✔ SIGNAL_HANDLER, ✔ DEBUG, ✖ TVM_OP]
 
 
 """
diff --git a/src/libinfo.cc b/src/libinfo.cc
index ae25146..27898ad 100644
--- a/src/libinfo.cc
+++ b/src/libinfo.cc
@@ -78,7 +78,7 @@ class FeatureSet {
     feature_bits.set(BLAS_MKL, MXNET_USE_BLAS_MKL);
     feature_bits.set(BLAS_APPLE, MXNET_USE_BLAS_APPLE);
     feature_bits.set(LAPACK, MXNET_USE_LAPACK);
-    feature_bits.set(MKLDNN, MXNET_USE_ONEDNN);
+    feature_bits.set(ONEDNN, MXNET_USE_ONEDNN);
 
     // Image
     feature_bits.set(OPENCV, MXNET_USE_OPENCV);
@@ -152,7 +152,7 @@ const std::vector<std::string> EnumNames::names = {
   "BLAS_MKL",
   "BLAS_APPLE",
   "LAPACK",
-  "MKLDNN",
+  "ONEDNN",
   "OPENCV",
   "DIST_KVSTORE",
   "INT64_TENSOR_SIZE",
diff --git a/tools/dependencies/README.md b/tools/dependencies/README.md
index c898112..0c06a98 100644
--- a/tools/dependencies/README.md
+++ b/tools/dependencies/README.md
@@ -49,12 +49,12 @@ MXNet is built on top of many dependencies. Managing these dependencies could be
 
 ## Overview
 
-The dependencies could be categorized by several groups: BLAS libraries, CPU-based performance boost library, i.e. MKLDNN and GPU-based performance boosting library including CUDA, cuDNN, NCCL. and others including OpenCV, Numpy, S3-related, PS-lite dependencies. The list below shows all the dependencies and their version. Except for CUDA, cuDNN, NCCL which the user is required to install on their environments, we statically link those dependencies into libmxnet.so when we build PyPi pac [...]
+The dependencies could be categorized by several groups: BLAS libraries, CPU-based performance boost library, i.e. ONEDNN and GPU-based performance boosting library including CUDA, cuDNN, NCCL. and others including OpenCV, Numpy, S3-related, PS-lite dependencies. The list below shows all the dependencies and their version. Except for CUDA, cuDNN, NCCL which the user is required to install on their environments, we statically link those dependencies into libmxnet.so when we build PyPi pac [...]
 
 | Dependencies  | MXNet Version |
 | :------------: |:-------------:| 
 |OpenBLAS| 0.3.9 |
-|MKLDNN| 0.19 | 
+|ONEDNN| 2.0 | 
 |CUDA| 10.1 |
 |cuDNN| 7.5.1 |
 |NCCL| 2.4.2 |
@@ -102,7 +102,7 @@ sudo apt-get install -y git \
     pkg-config
 ```
 
-### MKL, MKLDNN
+### MKL, ONEDNN
 
 @pengzhao-intel (https://github.com/apache/incubator-mxnet/commits?author=pengzhao-intel) and his team are tracking and updating these versions. Kudos to them!
 
diff --git a/tools/pip/setup.py b/tools/pip/setup.py
index f0c5844..246c8c4 100644
--- a/tools/pip/setup.py
+++ b/tools/pip/setup.py
@@ -141,14 +141,14 @@ else:
         libraries.append('CUDA-10.1')
 
 from mxnet.runtime import Features
-if Features().is_enabled("MKLDNN"):
-    libraries.append('MKLDNN')
+if Features().is_enabled("ONEDNN"):
+    libraries.append('ONEDNN')
 
 short_description += ' This version uses {0}.'.format(' and '.join(libraries))
 
 package_data = {'mxnet': [os.path.join('mxnet', os.path.basename(LIB_PATH[0]))],
                 'dmlc_tracker': []}
-if Features().is_enabled("MKLDNN"):
+if Features().is_enabled("ONEDNN"):
     shutil.copytree(os.path.join(CURRENT_DIR, 'mxnet-build/3rdparty/onednn/include'),
                     os.path.join(CURRENT_DIR, 'mxnet/include/onednn'))
 if platform.system() == 'Linux':