How to know that if I am using mkldnn

I am trying to use mkldnn to speed up training. My model is fasttext. I have followed the instruction of pytorch document (from source). But it seems that sometimes the training is still too slow. And also I want to know how many benefits I can gain by using mkldnn.

Try this:

import torch
print(*"\n"), sep="\n")

You will get the build information, if USE_MKLDNN=ON then you are good to go.

PS: this works for PyTorch 1.1 or earlier.