RE: MKLDNN Build (pre: call for contributions to next MXNet release)

2018-03-15 Thread Zhao, Patric
+source data to read clearly.

> -Original Message-
> From: Zhao, Patric [mailto:patric.z...@intel.com]
> Sent: Friday, March 16, 2018 8:29 AM
> To: 'dev@mxnet.incubator.apache.org' <dev@mxnet.incubator.apache.org>
> Cc: Huang, Jin1 <jin1.hu...@intel.com>; Da Zheng <zhengda1...@gmail.com>
> Subject: RE: MKLDNN Build (pre: call for contributions to next MXNet release)
> 
> Hi Pedro,
> 
> 
> 
> We and Zheng Da tested the performance on Mac laptop (Intel i7 CPU) as
> below table.
> 
> The test script is example/image-classification/benchmark_score.py.
> 
> 
> 
> MKLDNN shows better performance in MAC too.
> 
> 
> topo
> 
> batch size
> 
> gcc7 MKLDNN=1
> 
> gcc7 MKLDNN=0
> 
> speedup
> 
> alexnet
> 
>  1
> 
> 38.44
> 
> 24.49
> 
> 157%
> 
>  2
> 
> 50.18
> 
> 29.62
> 
> 169%
> 
>  4
> 
> 59.54
> 
> 35.40
> 
> 168%
> 
>  8
> 
> 70.75
> 
> 32.49
> 
> 218%
> 
> 16
> 
> 73.40
> 
> 34.93
> 
> 210%
> 
> 32
> 
> 47.52
> 
> 37.19
> 
> 128%
> 
> vgg16
> 
>  1
> 
> 3.80
> 
> 2.13
> 
> 178%
> 
>  2
> 
> 3.52
> 
> 2.93
> 
> 120%
> 
>  4
> 
> 4.54
> 
> 3.01
> 
> 151%
> 
>  8
> 
> 5.12
> 
> 3.05
> 
> 168%
> 
> 16
> 
> 5.37
> 
> 3.12
> 
> 172%
> 
> 32
> 
> 5.36
> 
> 3.07
> 
> 175%
> 
> inception-bn
> 
>  1
> 
> 15.02
> 
> 14.04
> 
> 107%
> 
>  2
> 
> 25.32
> 
> 15.14
> 
> 167%
> 
>  4
> 
> 34.92
> 
> 14.97
> 
> 233%
> 
>  8
> 
> 27.96
> 
> 15.02
> 
> 186%
> 
> 16
> 
> 27.05
> 
> 15.10
> 
> 179%
> 
> 32
> 
> 32.29
> 
> 15.46
> 
> 209%
> 
> inception v3
> 
>  1
> 
> 10.03
> 
> 5.89
> 
> 170%
> 
>  2
> 
> 11.21
> 
> 5.99
> 
> 187%
> 
>  4
> 
> 13.04
> 
> 5.89
> 
> 221%
> 
>  8
> 
> 12.97
> 
> 6.01
> 
> 216%
> 
> 16
> 
> 12.55
> 
> 5.13
> 
> 245%
> 
> 32
> 
> 12.52
> 
> 5.65
> 
> 222%
> 
> resnet-50
> 
>  1
> 
> 15.53
> 
> 7.07
> 
> 220%
> 
>  2
> 
> 14.85
> 
> 7.06
> 
> 210%
> 
>  4
> 
> 17.08
> 
> 7.88
> 
> 217%
> 
>  8
> 
> 16.91
> 
> 8.97
> 
> 189%
> 
> 16
> 
> 15.55
> 
> 9.42
> 
> 165%
> 
> 32
> 
> 16.60
> 
> 7.99
> 
> 208%
> 
> resnet-152
> 
>  1
> 
> 5.90
> 
> 3.55
> 
> 166%
> 
>  2
> 
> 5.64
> 
> 3.23
> 
> 175%
> 
>  4
> 
> 6.11
> 
> 3.08
> 
> 198%
> 
>  8
> 
> 5.22
> 
> 3.58
> 
> 146%
> 
> 16
> 
> 5.28
> 
> 3.86
> 
> 137%
> 
> 32
> 
> 6.20
> 
> 3.72
> 
> 167%
> 
> 
> 
> 
> 
> 
> > -Original Message-
> 
> > From: Zhao, Patric
> 
> > Sent: Wednesday, March 14, 2018 9:33 PM
> 
> > To: dev@mxnet.incubator.apache.org
> 
> > Cc: Huang, Jin1 <jin1.hu...@intel.com>
> 
> > Subject: MKLDNN Build (pre: call for contributions to next MXNet release)
> 
> >
> 
> > Hi Pedro,
> 
> >
> 
> > Thanks for the good suggestions. I plan to update the install page but a 
> > slight
> 
> > delay by other things.
> 
> >
> 
> > Actually, I didn't test the performance on OSX since we're lack of Mac
> machine.
> 
> >
> 
> > I will try if I can get a Mac in the office.
> 
> >
> 
> > Thanks,
> 
> >
> 
> > --Patric
> 
> >
> 
> >
> 
> > > -Original Message-
> 
> > > From: Pedro Larroy [mailto:pedro.larroy.li...@gmail.com]
> 
> > > Sent: Wednesday, March 14, 2018 9:09 PM
> 
> > > To: dev@mxnet.incubator.apache.org
> 
> > > Subject: Re: call for contributions to next MXNet release
> 
> > >
> 
> > > Hi Patric
> 
> > >
> 
> > > Does it make sense to add instructions to link against mkl in the install 
> > > docs?
> 
> > >
> 
> > > For example in OSX you can use MKL by downloading
> 
> > > https://github.com/intel/mkl-dnn/releases and adding MKL_RT_LIBRARY
> 
> > > and MKL_INCLUDE_DIR plus  -DUSE_MKL_IF_AVAILABLE=ON -
> 
> > > DUSE_MKLML_MKL=ON -DUSE_MKLDNN=ON
> 
> > >
> 
> > > This is not documented in the website.
> 
&g

RE: MKLDNN Build (pre: call for contributions to next MXNet release)

2018-03-15 Thread Zhao, Patric
Hi Pedro,



We and Zheng Da tested the performance on Mac laptop (Intel i7 CPU) as below 
table.

The test script is example/image-classification/benchmark_score.py.



MKLDNN shows better performance in MAC too.


topo

batch size

gcc7 MKLDNN=1

gcc7 MKLDNN=0

speedup

alexnet

 1

38.44

24.49

157%

 2

50.18

29.62

169%

 4

59.54

35.40

168%

 8

70.75

32.49

218%

16

73.40

34.93

210%

32

47.52

37.19

128%

vgg16

 1

3.80

2.13

178%

 2

3.52

2.93

120%

 4

4.54

3.01

151%

 8

5.12

3.05

168%

16

5.37

3.12

172%

32

5.36

3.07

175%

inception-bn

 1

15.02

14.04

107%

 2

25.32

15.14

167%

 4

34.92

14.97

233%

 8

27.96

15.02

186%

16

27.05

15.10

179%

32

32.29

15.46

209%

inception v3

 1

10.03

5.89

170%

 2

11.21

5.99

187%

 4

13.04

5.89

221%

 8

12.97

6.01

216%

16

12.55

5.13

245%

32

12.52

5.65

222%

resnet-50

 1

15.53

7.07

220%

 2

14.85

7.06

210%

 4

17.08

7.88

217%

 8

16.91

8.97

189%

16

15.55

9.42

165%

32

16.60

7.99

208%

resnet-152

 1

5.90

3.55

166%

 2

5.64

3.23

175%

 4

6.11

3.08

198%

 8

5.22

3.58

146%

16

5.28

3.86

137%

32

6.20

3.72

167%






> -Original Message-

> From: Zhao, Patric

> Sent: Wednesday, March 14, 2018 9:33 PM

> To: dev@mxnet.incubator.apache.org

> Cc: Huang, Jin1 <jin1.hu...@intel.com>

> Subject: MKLDNN Build (pre: call for contributions to next MXNet release)

>

> Hi Pedro,

>

> Thanks for the good suggestions. I plan to update the install page but a 
> slight

> delay by other things.

>

> Actually, I didn't test the performance on OSX since we're lack of Mac 
> machine.

>

> I will try if I can get a Mac in the office.

>

> Thanks,

>

> --Patric

>

>

> > -Original Message-

> > From: Pedro Larroy [mailto:pedro.larroy.li...@gmail.com]

> > Sent: Wednesday, March 14, 2018 9:09 PM

> > To: dev@mxnet.incubator.apache.org

> > Subject: Re: call for contributions to next MXNet release

> >

> > Hi Patric

> >

> > Does it make sense to add instructions to link against mkl in the install 
> > docs?

> >

> > For example in OSX you can use MKL by downloading

> > https://github.com/intel/mkl-dnn/releases and adding MKL_RT_LIBRARY

> > and MKL_INCLUDE_DIR plus  -DUSE_MKL_IF_AVAILABLE=ON -

> > DUSE_MKLML_MKL=ON -DUSE_MKLDNN=ON

> >

> > This is not documented in the website.

> >

> > What's the performance increase of using MKL in osx when running in

> > CPU mode?

> >

> > Pedro

> >

> > On Wed, Mar 14, 2018 at 1:54 PM, Zhao, Patric <patric.z...@intel.com>

> > wrote:

> >

> > > My fault, typo for your name, Larroy  :(

> > >

> > > > -Original Message-

> > > > From: Zhao, Patric [mailto:patric.z...@intel.com]

> > > > Sent: Wednesday, March 14, 2018 8:40 PM

> > > > To: dev@mxnet.incubator.apache.org; Huang, Jin1

> > > > <jin1.hu...@intel.com>

> > > > Subject: RE: call for contributions to next MXNet release

> > > >

> > > > Thanks, Larryo.

> > > >

> > > > This is a PR to fix this issue,

> > > > https://github.com/apache/incubator-

> > > > mxnet/pull/10075

> > > > The issue will be gone after this PR is merged.

> > > >

> > > > For the whole logic, we are investigating now and maybe propose a

> > > > new approach for Makefile and CMake.

> > > >

> > > > > -Original Message-

> > > > > From: Pedro Larroy [mailto:pedro.larroy.li...@gmail.com]

> > > > > Sent: Wednesday, March 14, 2018 8:31 PM

> > > > > To: dev@mxnet.incubator.apache.org

> > > > > Subject: Re: call for contributions to next MXNet release

> > > > >

> > > > > Hi

> > > > >

> > > > > Can you please fix the build logic?

> > > > > https://github.com/apache/incubator-

> > > > > mxnet/blob/master/CMakeLists.txt#L158

> > > > >

> > > > > https://github.com/apache/incubator-mxnet/issues/10072

> > > > >

> > > > > It wrongly assumes that you have MKL installed, MKLDNN needs to

> > > > > check if MKL is available before, or be disabled by default,

> > > > > also in non

> > > intel

> > > > platforms.

> > > > >

> > > > > Pedro

> > > > >

> > > > > On Sun, Mar 11, 2018 at 2:43 PM, Zhao, Patric

> > > > > <patric.z...@intel.com>

> > > 

MKLDNN Build (pre: call for contributions to next MXNet release)

2018-03-14 Thread Zhao, Patric
Hi Pedro,

Thanks for the good suggestions. I plan to update the install page but a slight 
delay by other things.

Actually, I didn't test the performance on OSX since we're lack of Mac machine.

I will try if I can get a Mac in the office.

Thanks,

--Patric


> -Original Message-
> From: Pedro Larroy [mailto:pedro.larroy.li...@gmail.com]
> Sent: Wednesday, March 14, 2018 9:09 PM
> To: dev@mxnet.incubator.apache.org
> Subject: Re: call for contributions to next MXNet release
> 
> Hi Patric
> 
> Does it make sense to add instructions to link against mkl in the install 
> docs?
> 
> For example in OSX you can use MKL by downloading
> https://github.com/intel/mkl-dnn/releases and adding MKL_RT_LIBRARY and
> MKL_INCLUDE_DIR plus  -DUSE_MKL_IF_AVAILABLE=ON -
> DUSE_MKLML_MKL=ON -DUSE_MKLDNN=ON
> 
> This is not documented in the website.
> 
> What's the performance increase of using MKL in osx when running in CPU
> mode?
> 
> Pedro
> 
> On Wed, Mar 14, 2018 at 1:54 PM, Zhao, Patric 
> wrote:
> 
> > My fault, typo for your name, Larroy  :(
> >
> > > -Original Message-
> > > From: Zhao, Patric [mailto:patric.z...@intel.com]
> > > Sent: Wednesday, March 14, 2018 8:40 PM
> > > To: dev@mxnet.incubator.apache.org; Huang, Jin1
> > > 
> > > Subject: RE: call for contributions to next MXNet release
> > >
> > > Thanks, Larryo.
> > >
> > > This is a PR to fix this issue, https://github.com/apache/incubator-
> > > mxnet/pull/10075
> > > The issue will be gone after this PR is merged.
> > >
> > > For the whole logic, we are investigating now and maybe propose a
> > > new approach for Makefile and CMake.
> > >
> > > > -Original Message-
> > > > From: Pedro Larroy [mailto:pedro.larroy.li...@gmail.com]
> > > > Sent: Wednesday, March 14, 2018 8:31 PM
> > > > To: dev@mxnet.incubator.apache.org
> > > > Subject: Re: call for contributions to next MXNet release
> > > >
> > > > Hi
> > > >
> > > > Can you please fix the build logic?
> > > > https://github.com/apache/incubator-
> > > > mxnet/blob/master/CMakeLists.txt#L158
> > > >
> > > > https://github.com/apache/incubator-mxnet/issues/10072
> > > >
> > > > It wrongly assumes that you have MKL installed, MKLDNN needs to
> > > > check if MKL is available before, or be disabled by default, also
> > > > in non
> > intel
> > > platforms.
> > > >
> > > > Pedro
> > > >
> > > > On Sun, Mar 11, 2018 at 2:43 PM, Zhao, Patric
> > > > 
> > > > wrote:
> > > >
> > > > > Steffen, really thanks for the helps and I totally agree with
> > > > > you and Marco's suggestions.
> > > > > I will summarize the open issues and status for the review soon.
> > > > >
> > > > > > What is your github handle?
> > > > > Github ID:  Patric Zhao, https://github.com/pengzhao-intel/ Da
> > Zheng,
> > > > > https://github.com/zheng-da/
> > > > >
> > > > > > - do you have design docs we can link to? Does the doc cover
> > > > > > packaging,
> > > > > use
> > > > > > of MXNet with full MKL (I understand there are license issues,
> > > > > > but we do
> > > > > have
> > > > > > users who are or plan to use MXNet with the complete MKL
> > > > > > package, not
> > > > > just
> > > > > > DNN subset)?
> > > > > Design doc:
> > > > > https://cwiki.apache.org/confluence/display/MXNET/The+
> > > > > design+of+MKLDNN+integration
> > > > > It's a good suggestion for the full MKL package and we will add
> > > > > the related part in the doc.
> > > > >
> > > > > > - do you have performance measurements (or plan to measure) to
> > > > > > include in release notes?
> > > > > Yes, we have tested the performance on all C4/C5 instances
> > > > > (8x,4x,2x,xlarge,large). And the accuracy are verified as well.
> > > > > We plan to publish these data both in the release note and mxnet
> > > > > website ( https://mxnet.incubator.apache.org/faq/perf.html).
> > > > >
> > > > > > - should we talk about the package at the Apr 24th meetup in
> > Seattle?
> > > > > We're based in Shanghai, China; so maybe @Da Zheng?
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Steffen Rochel [mailto:steffenroc...@gmail.com]
> > > > > > Sent: Sunday, March 11, 2018 6:11 PM
> > > > > > To: dev@mxnet.incubator.apache.org
> > > > > > Cc: marco.g.ab...@googlemail.com
> > > > > > Subject: Re: call for contributions to next MXNet release
> > > > > >
> > > > > > Patric - added MKL-DNN to the project list. What is your
> > > > > > github
> > handle?
> > > > > > I do agree with Marco that we need to resolve disable tests,
> > > > > > broken
> > > > > features
> > > > > > etc. Jira looks like the right answer to create a list of
> > > > > > known
> > issues.
> > > > > > Questions I do have:
> > > > > > - do you have design docs we can link to? Does the doc cover
> > > > > > packaging,
> > > > > use
> > > > > > of MXNet with full MKL (I understand there are license issues,
> > > > > > but we do
> > > > > have
> > > > > > users who are or plan to use