KaldiDecoder (Source Compilation for person concerned)
These instructions are for KaldiDecoder latest version.
Compilation Environment
- OS
- Ubuntu 20.04 Focal (64bit)
- Ubuntu 22.04 Jammy (64bit)
- Ubuntu 24.04 Noble (64bit)
Notes: KaldiDecoder uses the Kaldi libraries, so it can only be built in an environment supported by the Kaldi officially site (http://kaldi-asr.org/).
Installation instruction
#### Step.1 Get build tools and dependent libraries. sudo apt update sudo apt install git automake autoconf libtool cmake cmake-extras build-essential libopenblas-base libopenblas-dev gfortran liblapack-dev liblapacke-dev zlib1g-dev sox #### Step.2 Get the unofficial Kaldi source code. cd ~/ mkdir YOUR_DIR cd YOUR_DIR #### Do the following only for the first time. # git clone https://harkdev.backlog.jp/git/KALDI/kaldi.git # (cd kaldi ; git checkout feature-kaldi20220526-rebased-kaldidecoder-add-attrib-2304 ) # or # git clone https://github.com/kaldi-asr/kaldi.git # (cd kaldi ; git checkout 1a233a11db ; wget http://archive.hark.jp/harkrepos/dists/jammy/non-free/source/kaldidecoder-hark_3.5.0.tar.xz ; tar -Jxvf kaldidecoder-hark_3.5.0.tar.xz ) cd kaldi #### Step.3 Build Kaldi's external tool (and dependent library). cd tools extras/check_dependencies.sh make #### Step.4 Build Kaldi with the set up to use openblas library. cd ../src mkdir fakeroot ln -s /usr/include/x86_64-linux-gnu/ fakeroot/include ln -s /usr/lib/x86_64-linux-gnu/ fakeroot/lib ./configure --mathlib=OPENBLAS --openblas-root=fakeroot make clean -j CORES make depend -j CORES make -j CORES ## CORES : An integer obtained by dividing the free memory capacity [GB] by 2 and rounding down to the nearest whole number. If it is less than 1, the build will fail. #### Step5. Build KaldiDecoder. cd ../kaldidecoder3 mkdir build cd build cmake .. -DOPENBLAS_ROOT_DIR:STRING=/usr -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE make sudo make install
Q&A
Q.1 Is there a way to enable CUDA?
A.1 Steps 1 to 3 are the same. For installation of CUDA toolkit please refer to nVidia official installation instructions.
- nVidia CUDA Toolkit
-
https://developer.nvidia.com/cuda-downloads
#### Step.4 Build Kaldi with the set up to use openblas library. (with CUDA) #### Only the arguments of '--use-cuda' and '--cudatk-dir=PATH' have been added #### by the './configure' command. cd ../src mkdir fakeroot ln -s /usr/include/x86_64-linux-gnu/ fakeroot/include ln -s /usr/lib/x86_64-linux-gnu/ fakeroot/lib ./configure --mathlib=OPENBLAS --openblas-root=fakeroot --use-cuda --cudatk-dir=/usr/local/cuda make clean -j CORES make depend -j CORES make -j CORES #### Step5. Build KaldiDecoder. (with CUDA) #### Only the arguments of '-DUSE_CUDA=ON' have been added by the 'cmake' command. cd ../kaldidecoder3 mkdir build cd build cmake .. -DOPENBLAS_ROOT_DIR:STRING=/usr -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DUSE_CUDA=ON make sudo make install
If you have multiple versions of CUDA installed and you want to set your PATH:
cmake .. -DOPENBLAS_ROOT_DIR:STRING=/usr -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DUSE_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.0
Make sure that the PATH specified here is the same as the PATH specified in Step 4.