-
Notifications
You must be signed in to change notification settings - Fork 6.8k
USE_MKLDNN=1 is default in make build (mkldnn must be explicitly turned off) #12591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip package distribution explicitly sets mkldnn=0 so it won't be a problem. On the other hand, I'd like to see enough evidence that it's the right thing to do first:
- the performance difference between regular build and mkldnn build on various hardware.
- numeric stability and modeling convergence evaluation.
- portability.
will look into portability @mseth10 can you publish accuracy and performance with a small dataset like CIFAR. |
@mxnet-label-bot[pr-awaiting-response] |
I think @juliusshufan can help to provide the more accuracy and performance data. |
Update the ImageNet-1k inference accuracy, based on Gluon-model zoo (pre-trained model), comparison target is NVidia-GPU. On Python2
On Python3
|
Apart from ImageNet-1k traning test, training test also been executed on small dataset, that includes:
Due to the lackness of the SOTA accuracy data on these small dataset, the comparisons between MXNET-MKLDNN and MXNET-GPU on convergence trends and inference accuracy will be "indirectly" used as the correctness check of MXNET with MKLDNN backend. On Resnet-50:
On Inception-v3, (as inception-v3 only accepts input size 299, CIFAR is not applicable)
On VGG-16:
The below two figures are the top-5 validation accuracy trends collected on CPU and GPU respectively, |
Benchmark data On CentOS 7.4, pip is used for MXNET installation, that is pip install mxnet==1.3.0 v.s. pip install mxnet-mkl==1.3.0. VGG16
Inception-v3
Inception-v4
ResNet-50
MobileNet
On MacOS, the default compilation configurations disabling the OPENMP, below tables listing the perf datas on build with MKLDNN(OPENMP enabled), and the build without MKLDNN. VGG16
Inception-v3
Inception-V4
ResNet-50
MobileNet
|
Just verifying. The above table is for Mac? |
Can we try metrics with MacOS on AVX2 ISA? We are seeing performance drop enabling MKLDNN. |
|
Hi @azai91 , you can try the below building method on mac:
|
While the speed-up looks solid, I noticed the following:
I also have the following questions regarding the results:
Overall, I think these evaluation doesn't yet cover the most important question for this PR: can we say with confidence that by switching to USE_MKLDNN by default, our library can achieve speed-up without losing accuracy, for different CPUs? |
Note that for larger datasets it's unlikely that people would use it for training, so inference results with pre-trained models would suffice for the purpose of comparing mkl builds with regular builds. |
Thanks for looking into our data and I agree that the inference results are more important. |
@pengzhao-intel @juliusshufan also add performance on iMac Pro based on building method referred in #12724 |
I'd love to see this one merged, and MXNet users benefitting from improved performance on CPU, but I agree with comments made earlier by @szha that we need clear comparison for speed and accuracy between non-MKLDNN and MKLDNN. I also suggest we document these benchmarks and results on MXNet CWiki instead of in this issue - will be easier to see a full and up-to-date status there. @xinyu-intel if it makes sense to you, can you please document it there? |
@lupesko It's a good idea to document the benchmark results in the website rather than github. |
@juliusshufan can you provide benchmarks comparing mkldnn vs non? |
@azai91 sure, some CNN perf/benchmark data already updated the previous comments (my fourth comment) of this PR, do you mean more model coverage? And I'll also update the same content to the on CWiki page. |
@azai91 I will sync with @juliusshufan in local. Will launch the benchmark during weekend :) |
@pengzhao-intel thanks for the update. can you list platforms and build flags in benchmarks as well. let me know when you're done. planning on taking vote Tuesday or Wednesday. |
Latest data updated on this wiki page: @azai91 could you rebase the code? |
Results with mobilenet
|
@azai91 which compiler are you using to build mxnet with mkldnn on m5a.24xlarge? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The benchmark effort is really impressive. Could we add some more information how it was performed? I mean what scripts were called, which models downloaded?
I could reuse this information to perform another comparison: testing performance when compiled with different compilers (with different OpenMP libraries).
ci/docker/runtime_functions.sh
Outdated
@@ -170,6 +171,7 @@ build_armv7() { | |||
-DCMAKE_BUILD_TYPE=Release \ | |||
-DUSE_MKL_IF_AVAILABLE=OFF \ | |||
-DUSE_LAPACK=OFF \ | |||
-DUSE_MKLDNN=0FF \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed the default behaviour for make builds, but as far as I know for cmake it was ON
by default (is available). Why do we want to switch it explicitly OFF
?
@mxnet-label-bot add [MKLDNN] |
…tor-mxnet into feature/mklnn-default-make
@azai91 Thanks for the contribution, could you trigger CI again? |
Do you also need to update osx.mk? Please make sure it's working the same on Mac OS |
…tor-mxnet into feature/mklnn-default-make
…tor-mxnet into feature/mklnn-default-make
@azai91 - Thanks a lot for this PR. |
@azai91 we can close this PR now? |
@mseth10 Yes, I think so.
@lupesko @sandeep-krishnamurthy @mseth10 @azai91 @TaoLv @xinyu-intel @ZhennanQin |
@@ -669,7 +662,6 @@ build_ubuntu_gpu_cmake() { | |||
-DUSE_CUDA=1 \ | |||
-DUSE_CUDNN=1 \ | |||
-DUSE_MKLML_MKL=0 \ | |||
-DUSE_MKLDNN=0 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is supposed to be removed.
closing this PR as this is a duplicate of #13681 |
Description
we are migrating to have mkldnn included in the default mxnet build. the USE_MKLDNN will be set to 1 by default (and therefore must explicitly be turned off if unsupported).
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments