Bastian
Bastian

Reputation: 1593

libtorch throws c10::error after build on Windows 10 (VS2019)

I've tried to build libtorch on Windows 10 using VS 2019 without CUDA and Python. Independent if I compile it with or without MKL, a simple test program crashes directly after start. After building the debug version, libtorch throws a c10:error in a function called torchCheckFail.

The function seems to complain about ATen/core/jit_type.h.

The problem is part of torch_cpu.dll. The problem disappears when I'm using the precompiled binaries for Windows.

Here's the function:

void torchCheckFail(
    const char* func,
    const char* file,
    uint32_t line,
    const std::string& msg) {
  throw ::c10::Error({func, file, line}, msg);
}

And here's the call stack:

Call Stack

Upvotes: 1

Views: 1188

Answers (2)

lollows
lollows

Reputation: 71

I have provided a similar answer here. Please take a look at it for more information.

TL/DR: try to use cmake + Ninja + x64 Native Tools Command Prompt for VS 2019 to build libtoch on windows 10, which maybe helps. The idea comes from this issue.

Upvotes: 1

R_B
R_B

Reputation: 11

I encountered the same exact error with the same environment.

A solution that worked for me was to take a release version of pytorch and not a non-release one (i.e. a release version + some commits).

Hope it helps.

Upvotes: 1

Related Questions