The performance of LibTorch which compiled by ourselves is worse than that provided by the government

A. ENV
1. centos 7
2. Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
3. gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
4. Python 3.8.5 (default, Sep 4 2020, 07:30:14)

B. compile method
1. git clone --recursive GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
2. git checkout v1.8.1
3. git submodule sync
4. git submodule update --init --recursive
5. cd pytorch
6. mkdir pytorch-build
7. cd pytorch-build
8. export BUILD_TEST=0
9. export USE_CUDA=0
10. cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=which python3 -DCMAKE_INSTALL_PREFIX:PATH=…/pytorch-install …

C. TEST CODE
torch::jit::script::Module module;
module = torch::jit::load(argv[1]);
std::vectortorch::jit::IValue inputs;
at::Tensor input = torch::ones({1, 300, 40});
inputs.push_back(input);
at::Tensor output = module.forward(inputs).toTensor();

D. performance
1. The performance of LibTorch which compiled by ourselves is worse than that provided by the government
2.

E. compile libtorch with cpu options
1. how can i konw the official compile libtorch with cpu options ?

The pytorch/builder repository should contain all build scripts, so you could compare yours to the official one.

Thank u, I have solved this problem.

I check the cmake options and then I find that option USE_MKL is OFF .

there is a problem in my environmet, I do not install MKL.

so, I installed the MKL, and recompile the libtorch, and check the option USE_MKL=ON.

In the end, I made it.