安装MKL
- 到官网下载Intel® Math Kernel Library for Linux安装包
- 采用
tar -xvzf l_mkl_xxx.tgz命令解压安装包,进入解压后的安装包,运行./install.sh脚本执行安装过程 - 根据提示一路接受,默认安装路径是/opt/intel
- 在目录/opt/intel/mkl/bin下执行
./mklvars.sh intel64 - 编辑
vi ~/.bashrc设置环境变量 - 在末尾加入代码:
export PATH=/opt/intel/bin:$PATH
export LD_LIBRARY_PATH= /opt/intel/lib/intel64:/opt/intel/mkl/lib/intel64:$LD_LIBRARY_PATH -
$ source ~/.bashrc如果没有报错,则path生效
安装Boost
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gztar zxvf boost_1_64_0.tar.gzcd boost_1_64_0./bootstrap.sh./b2 install
安装kenlm
安装kenlm之前需要安装好boost,xz,zlib,bzip,libbz2-dev等依赖。
它们的安装参考博客:https://blog.csdn.net/sinat_33741547/article/details/79996742
wget https://kheafield.com/code/kenlm.tar.gztar -xvzf kenlm.tar.gzcd kenlmmkdir build && cd buildcmake ..-
make -j 4
这样还无法在python环境中执行 cd kenlmpython setup.py installpython #进入python环境import kenlm
安装gflags
sudo apt-get install libgflags-dev
安装glog
git clone https://github.com/google/glogsudo apt-get install autoconf automake libtoolcd glog./autogen.sh./configuremake -j 4make install
安装google test
git clone https://github.com/google/googletest.gitmkdir mybuildcd mybuildcmake ${GTEST_DIR} #google test的下载目录,比如我clone到了/data/xxx/googletestmakemake install
安装fftw
sudo apt-get install fftw3
安装libsndfile:
git clone git://github.com/erikd/libsndfile.git-
sudo apt install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev pkg-config python cd libsndfile./autogen.sh./configure --enable-werrormake-
make check
为了产生wav2letter++需要的.cmake配置文件 mkdir CMakeBuildcd CMakeBuildcmake ..makesudo make install
安装ArrayFire
-
sudo apt-get install -y build-essential git cmake libfreeimage-dev
sudo apt-get install -y cmake-curses-gui sudo apt-get install libglfw3-dev libfontconfig1-dev libglm-devgit clone --recursive https://github.com/arrayfire/arrayfire.gitcd arrayfiremkdir build && cd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -j 4make install
然而我build一直有问题,最后也没成功。于是采用方法二:
- 直接下载:ArrayFire-v3.6.1_Linux_x86_64.sh
bash ArrayFire-v3.6.1_Linux_x86_64.sh- 之后wav2letter++在cmake时加入选项:
-DArrayFire_DIR=/xxx/arrayfire/share/ArrayFire/cmake
安装NCCL
到NVIDIA官网下载NCCL,选择对应的版本:

切换到NCCL文件所在目录,运行以下命令:
sudo dpkg -i nccl-repo-ubuntu1604-2.3.7-ga-cuda9.2_1-1_amd64.debsudo apt-get updatesudo apt install libnccl2=2.3.7-1+cuda9.2 libnccl-dev=2.3.7-1+cuda9.2
安装flashlight
注意安装flashlight之前需要安装好arrayfire和nccl [flashlight还需要CUDA>=9.2,CUDNN>=7.2.1,所以我又去装了cuda9.2 :(]
git clone https://github.com/facebookresearch/flashlight.gitexport MKLROOT=/opt/intel/mklmkdir -p build #in the flashlight project directory:cd build-
cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CUDA- 报错找不到ArrayFire,加上
-D ArrayFire_DIR=/data/zd/arrayfire/share/ArrayFire/cmake选项; - 报错找不到CUDA,加上
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2选项;
- 报错找不到ArrayFire,加上
make -j 4 #(or any number of threads)make test-
make install
发现报错
可能是创建不了文件夹,于是改成CMake Error at cmake_install.cmake:36 (file): file INSTALL cannot make directory "/usr/local/include/flashlight/cereal/cereal": No such file or directorysudo make install成功。
安装wav2letter++
终于来到这一步了orz...
git clone --recursive https://github.com/facebookresearch/wav2letter.gitmkdir -p buildcd build-
cmake .. -DCMAKE_BUILD_TYPE=Release -DCRITERION_BACKEND=CUDA
-DArrayFire_DIR=/data/zd/arrayfire/share/ArrayFire/cmake
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2 make -j4
cmake过程依然出错:
-- Looking for KenLM
CMake Error at cmake/Findkenlm.cmake:47 (message):
kenlm library not found; please set CMAKE_LIBRARY_PATH or KENLM_LIB
Call Stack (most recent call first):
src/decoder/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
需要在~/.bashrc中加上环境变量
export KENLM_ROOT_DIR=[your kenlm directory]
然后依然有错:
-- Library mkl: not found
CMake Error at cmake/FindMKL.cmake:265 (MESSAGE):
MKL library not found. Please specify library location
Call Stack (most recent call first):
src/feature/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
继续在~/.bashrc中加上环境变量
export MKLROOT=/opt/intel/mkl
至此大功告成 :)。
参考文章:
https://www.cnblogs.com/venus024/p/5619373.html --MKL https://blog.csdn.net/u011641865/article/details/73498533 --Boost
https://blog.csdn.net/sinat_33741547/article/details/79996742 --kenlm
http://blog.topspeedsnail.com/archives/5462 --fftw
如果最后始终配置不成功,推荐使用Docker吧:-)