How to compile with NNPack or MKLDNN

Compile pytorch from the latest git library. How to set the variables to let cmake detect NNPack or MKLDNN , I found there are variables like NO_MKLDNN WITH_MKLDNN MKLDNN_LIBRARY MKLDNN_LIB_DIR MKLDNN_INCLUDE_DIR . How to pass these variables to cmake?

Does NNPack or MKLDNN speed up for double precision?

Top Up!
I really need to improve the inference performance on CPU. After I found the benckmark of mkldnn, I want to have a try. However, compiling pytorch with mkldnn seems not native, because I have to struggle with variables like NO_MKLDNN, WITH_MKLDNN, MKLDNN_* … I wish compiling pytorch with mkldnn will be much easier, just as easy as linking mkl or openblas.

hi, Xiao Liang. you need to install MKLDNN from conda first and then follow the installation steps from README.
conda install -c mingfeima mkldnn

Performance speedup you can get strongly depends on your CPU type. The optimization from MKLDNN is mostly for Xeon CPU. We also have some BKM for better CPU performance. i upload some benchmark numbers at link. you can take a look.

The optimization job is still working in progress and we will continuously boost up cpu performance. Conv performance should be much faster with MKLDNN, rnn optimization is currently under review.

If you run on Xeon CPU, NNPACK is definitely not as performant as MKLDNN, we double checked this before.

Let me know if you have trouble compiling with MKLDNN.

hi,did you solve the problem? how to install pytorch with nnpack on cpu?
really looking forward to your reply