Skip to content

Build failed when use shared MKL library #138994

@xuhancn

Description

@xuhancn
          Which version of oneAPI are you using to build pytorch? I am using oneAPI binaries from https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpu/2-5.html and I am getting linking errors:
   Creating library lib\torch_cpu.lib and object lib\torch_cpu.exp
MklAllocationHelper.cpp.obj : error LNK2019: unresolved external symbol i_malloc referenced in function "void __cdecl `dynamic initializer for 'g_b_registered_mkl_alloction''(void)" (??__Eg_b_registered_mkl_alloction@@YAXXZ)
MklAllocationHelper.cpp.obj : error LNK2019: unresolved external symbol i_calloc referenced in function "void __cdecl `dynamic initializer for 'g_b_registered_mkl_alloction''(void)" (??__Eg_b_registered_mkl_alloction@@YAXXZ)
MklAllocationHelper.cpp.obj : error LNK2019: unresolved external symbol i_realloc referenced in function "void __cdecl `dynamic initializer for 'g_b_registered_mkl_alloction''(void)" (??__Eg_b_registered_mkl_alloction@@YAXXZ)
MklAllocationHelper.cpp.obj : error LNK2019: unresolved external symbol i_free referenced in function "void __cdecl `dynamic initializer for 'g_b_registered_mkl_alloction''(void)" (??__Eg_b_registered_mkl_alloction@@YAXXZ)
bin\torch_cpu.dll : fatal error LNK1120: 4 unresolved externals

Looking at CMakeFiles/torch_cpu.rsp I see that mkl_core_dll.lib is used for linking and it doesn't define these i_* symbols.

Originally posted by @gshimansky in #138419 (comment)

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @gujinghui @EikanWang @fengyuan14 @guangyey

Metadata

Metadata

Assignees

Labels

module: mklRelated to our MKL supportmodule: windowsWindows support for PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions