美文网首页
Building wav2letter++ 安装依赖

Building wav2letter++ 安装依赖

作者: 乘瓠散人 | 来源:发表于2019-01-03 10:55 被阅读327次

安装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.gz
  • tar zxvf boost_1_64_0.tar.gz
  • cd 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.gz
  • tar -xvzf kenlm.tar.gz
  • cd kenlm
  • mkdir build && cd build
  • cmake ..
  • make -j 4
    这样还无法在python环境中执行
  • cd kenlm
  • python setup.py install
  • python #进入python环境
  • import kenlm

安装gflags

sudo apt-get install libgflags-dev

安装glog

  • git clone https://github.com/google/glog
  • sudo apt-get install autoconf automake libtool
  • cd glog
  • ./autogen.sh
  • ./configure
  • make -j 4
  • make install

安装google test

  • git clone https://github.com/google/googletest.git
  • mkdir mybuild
  • cd mybuild
  • cmake ${GTEST_DIR} #google test的下载目录,比如我clone到了/data/xxx/googletest
  • make
  • make install

安装fftw

sudo apt-get install libfftw3

安装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-werror
  • make
  • make check
    为了产生wav2letter++需要的.cmake配置文件
  • mkdir CMakeBuild
  • cd CMakeBuild
  • cmake ..
  • make
  • sudo make install

安装ArrayFire

ArrayFire for Linux官方教程

  • 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-dev
  • git clone --recursive https://github.com/arrayfire/arrayfire.git
  • cd arrayfire
  • mkdir build && cd build
  • cmake .. -DCMAKE_BUILD_TYPE=Release
  • make -j 4
  • make 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,选择对应的版本:

image.png
切换到NCCL文件所在目录,运行以下命令:
  • sudo dpkg -i nccl-repo-ubuntu1604-2.3.7-ga-cuda9.2_1-1_amd64.deb
  • sudo apt-get update
  • sudo 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.git
  • export MKLROOT=/opt/intel/mkl
  • mkdir -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选项;
  • 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 directory
    
    可能是创建不了文件夹,于是改成sudo make install成功。

安装wav2letter++

终于来到这一步了orz...

  • git clone --recursive https://github.com/facebookresearch/wav2letter.git
  • mkdir -p build
  • cd 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

相关文章

网友评论

      本文标题:Building wav2letter++ 安装依赖

      本文链接:https://www.haomeiwen.com/subject/bucblqtx.html