I would like to use MKL for BLAS operations. What should I set in my CMakeLists please? Do I need to enable any other build flags and or macros? Below see what my project CMakeLists looks like.
find_package(Torch REQUIRED PATHS /usr/local/libtorch)
set(LINK_LIBRARIES
${CONAN_LIBS}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${TORCH_LIBRARIES})
Calling C++ code looks like this:
#include <benchmark/benchmark.h>
#include <torch/torch.h>
static void torch_tensor_mult_test(benchmark::State &state) {
int size = state.range(0);
torch::Tensor m = torch::rand({size, size});
torch::Tensor v = torch::rand({size, 1});
torch::Tensor r = torch::rand({size, 1});
for (auto _ : state) {
r = m * v;
}
}
BENCHMARK(torch_tensor_mult_test)->RangeMultiplier(2)->Range(2, 8 << 7);
BENCHMARK_MAIN();