sudo apt-get install subversion svn update svn co https://kaldi.svn.sourceforge.net/svnroot/kaldi/trunk kaldi-trunk cd kaldi-trunk cd tools cat INSTALL make -j 4
注:
1.当电脑有不止一个cpu时,假设有四个,可以输入:make -j 4 以节省时间。
2.make指令是为了安装8个软件,其中,(sph2pipe, openfst, ATLAS)这3个是必须的。
第二步:配置
cd ../src ./configure
注:通常这个时候会报错,那是因为没有安装openfst或者ATLAS。
安装openfst:
1.安装g++
sudo apt-get install g++
2.解压
tar -xovzf openfst-1.3.2.tar.gz for dir in openfst-1.3.2/{src/,}include/fst; do ( [ -d $dir ] && cd $dir && patch -p0 -N <../../../../openfst.patch ) done rm openfst 2>/dev/null # Remove any existing link ln -s openfst-1.3.2 openfst cd openfst-1.3.2
以下选择正确的配置指令:
若是linux或darwin,
./configure --prefix=`pwd` --enable-static --disable-shared
若是64位系统,
./configure --host=x86_64-linux --prefix=`pwd` --enable-static --disable-shared
若是虚拟机,
./configure --prefix=`pwd` CXX=g++-4.exe CC=gcc-4.exe --enable-static --disable-shared
3.安装
sudo make install
安装ATLAS:
注:安装ATLAS前,要保证关掉cpu throttling。绝大部分操作系统默认开启power management中的cpu throttling以保护cpu。绝大部分电脑可以在BIOS中关掉cpu throttling(通常在power management中或cpu frequency 选项中。)绝大部分操作系统也能关掉cpu throttling,在fedora中,输入/usr/bin/cpufreq-selector -g performance可以关掉cpu throttling。本机器是ubuntu 12.04 cpu frequency scaling governor的路径是(/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)。此处建议使用:https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling_(简体中文)中的修改软件,修改后是临时的,重启之后恢复默认设置,这样不会对基础设置造成影响。
具体操作:
sudo apt-get install cpufrequtils sudo cpufreq-set -c 1 -g performance sudo cpufreq-set -c 2 -g performance sudo cpufreq-set -c 3 -g performance sudo cpufreq-set -c 4 -g performance cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor cat /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
查看里面的选项ondemand是否均改为performance。
除了更改cpu throttling,还要安装gfortran,否则会出错:
sudo apt-get install gfortran
最后,在tools目录下输入:
./install_atlas.sh
完成ATLAS的安装。
第三步:配置安装:
../src ./configure make depend make -j 4
经历一段漫长的等待之后,会有提示,安装完成。