Kaldi has recently switched to Intel Math Kernel Libraries (MKL) for linear algebra operations (as of April 2019). However, installing MKL (by running tools/extras/install_mkl.sh) requires root access. This post details how kaldi (with MKL) can be installed without root access.

  1. Download Kaldi
  2. Download the MKL standalone installer from here.
    • Extract the contents and launch the installer by running install.sh.
    • When asked for the path to install, specify a location where you have write access (e.g., /home/<username>/intel)
    • Complete the installation of MKL libraries
  3. Navigate to the kaldi folder kaldi/tools
  4. Typically the first step is to run extras/check_dependencies.sh. This will complain about the missing MKL libraries. This is because the script expects the MKL libraries to be located under /opt/intel directory. As of now (May 2019), there is no option to pass the mkl-root directory to this script. Therefore we will edit the extras/check_dependencies.sh script by changing /opt/intel/mkl/include/mkl.h to /home/<username>/intel/mkl/include/mkl.h. Then running extras/check_dependencies.sh should work fine without any MKL related warnings.
  5. Then run make -j <numcpu> to install the tools required by kaldi
  6. Navigate to the kaldi/src folder.
  7. Run ./configure with the --mkl-root option.
    ./configure --shared --mkl-root=/home/<username>/intel/mkl
    
  8. Then install kaldi using the usual steps
    make depend -j <numcpu>       
    make -j <numcpu>
    

This will install Kaldi with MKL support without requiring any root privileges.