candle
candle copied to clipboard
Using Intel's mkl on Linux
I'm trying to run some examples with Intel's mkl library. I'm running on Debian 12 so since their version of mkl is ancient (2020.4.304) I added the official Intel repository and installed from there with apt install intel-oneapi-mkl intel-oneapi-mkl-devel.
However, running cargo run --example mistral --release --features mkl -- --prompt 'Write an example fibonacci code in Rust' --sample-len 100 --quantized from latest main, I always get a linker error saying that there's an undefined reference to `hgemm_':
/usr/bin/ld: /media/robm/Extreme SSD/Devel/candle/target/release/deps/libcandle_core-1583f1d9914cd012.rlib(candle_core-1583f1d9914cd012.candle_core.b90b42375f6ed342-cgu.00.rcgu.o): in function `<candle_core::cpu_backend::CpuStorage as candle_core::backend::BackendStorage>::matmul':
candle_core.b90b42375f6ed342-cgu.00:(.text._ZN93_$LT$candle_core..cpu_backend..CpuStorage$u20$as$u20$candle_core..backend..BackendStorage$GT$6matmul17h13715ea796a334c9E+0x1a3a): undefined reference to `hgemm_'
collect2: error: ld returned 1 exit status
Is this supposed to be working or what said in #1456 is still true?
The intel-mkl-src crate doesn't seem to have been updated since the last issue so my guess is that you still need to install mkl manually.
I did install the libraries manually and also ran their /opt/intel/oneapi/setvars.sh script to define any required variables.
Funnily enough yesterday I found that if I try to compile a separate application with --features mkl it does compile properly (then it doesn't run properly because I'm still trying to understand how to use candle, but the behavior is the same also without any acceleration feature, so at least it builds/links 😅)
What exactly was done to install mkl support manually?
@matbee-eth I more or less followed this page: https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-download.html?operatingsystem=linux&linux-install=apt A first attempt was made with another repo that however was from 2020 and had trouble installing, then I found the official page (I should know better than using Google, but habits are hard to die...)