为kaldi安装GPU环境

  目的:由于kaldi有些模块的训练必须要用到GPU,因此拿到NVIDIA GTX1650显卡后开始配置GPU环境。

整体过程:在centos7系统上进行配置,出现了几个问题,最后问题不能解决,借鉴其他小伙伴成功经验,将系统换成了Ubuntu 16.04,顺利解决。

在Ubuntu 16.04上成功安装GPU环境参考链接:
https://blog.csdn.net/weixin_42858575/article/details/89817219
Win7系统下安装Ubuntu16.04
Ubuntu16.04下安装NVIDIA显卡驱动
https://blog.csdn.net/yinwangde/article/details/89439648
Ubuntu 16.04 上 CUDA_10.0及cuDNN的安装
https://blog.csdn.net/lihe4151021/article/details/90237681

在centos7上安装失败GPU环境的记录:
——、显卡部分:
https://www.jianshu.com/p/75e7053bdd43?from=timeline&isappinstalled=0
https://blog.csdn.net/weixin_41271279/article/details/83659711
安装步骤主要参考的以上2个链接里的内容。以下是安装时遇到的几个问题:
1、NVIDIA官网上写着cudnn-10.1-linux-x64-v8.0.3.33版本的cudnn与CUDA10.1匹配,但下载后里面的核心文件cudnn.h只有很多注释,不能用。于是又去下载了cudnn-10.1-linux-x64-v7.6.5.32版本的cudnn;
2、由于我在安装CUDA之前已经安装了显卡驱动,因此安装CUDA时要将它默认安装驱动的选项去掉,否则安装失败,如下,将Driver前面的×去掉;

另外,我在配上面环境时候,出现了切换到命令行不能用,显示 [ 0.182403]pnp 00:01: can't evaluate _CRS: 12311 未能解决

二、编译部分
1、在kaldi下的src进行make all编译时,出现如下报错:

In file included from /usr/include/++/4.8.2/cstdint:35:0,
from ../cudamatrix/cu-matrixdim.h:29
from ../cudamatrix/cu- kernels-ansi.h:29,
from cu- kernels.cu:31:
/usr/include/c++/4.8.2/bits/C++0x warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
#--error 0x1
make[1]: **** Icu-kernels.o] Error 1
make[1: Leaving directory /home/kaldi - trunk/src/cudamatrix
make: *** [cudamatrix] Error 2

查了一圈资料,原因应该是有些C++文件需要编译器支持C++11,我的gcc/g++编译器版本是4.8.5,虽然是支持C++11的,但它默认支持是C++03。(验证方法:https://blog.csdn.net/Betterc5/article/details/84503050),于是我选择将编译器直接升级到8.2.0版本(升级步骤参考:https://www.cnblogs.com/ToBeExpert/p/10297697.html)

2、继续编译:还是有报错,如下:
make[1]: Leaving directory `/home/kaldi-trunk/src/cudadecoder'
make -C bin
make[1]: Entering directory `/home/kaldi-trunk/src/bin'
g++ -std=c++11 -I.. -isystem /home/kaldi-trunk/tools/openfst-1.6.7/include -O1 -Wno-sign-compare -Wall -Wno-sign-compare -Wno-unused-local-typedefs -Wno-deprecated-declarations -Winit-self -DKALDI_DOUBLEPRECISION=0 -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_MKL -I/opt/intel/mkl/include -m64 -msse -msse2 -pthread -g -DHAVE_CUDA -I/usr/local/cuda/include -fPIC -pthread -isystem /home/kaldi-trunk/tools/openfst-1.6.7/include -c -o align-equal.o align-equal.cc
g++ -Wl,-rpath=/home/kaldi-trunk/tools/openfst-1.6.7/lib -rdynamic align-equal.o ../decoder/kaldi-decoder.a ../lat/kaldi-lat.a ../lm/kaldi-lm.a ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../tree/kaldi-tree.a ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a /home/kaldi-trunk/tools/openfst-1.6.7/lib/libfst.so -L/opt/intel/mkl/lib/intel64 -Wl,-rpath=/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -ldl -lpthread -lm -lm -lpthread -ldl -o align-equal
align-equal.o: In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, fst::FstHeader*)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/fst.h:746: undefined reference to `fst::FstHeader::Write(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::LogWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::LogWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, fst::FstHeader*)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/fst.h:746: undefined reference to `fst::FstHeader::Write(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >::WriteFstHeader(fst::Fst<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, fst::FstHeader*)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/fst.h:746: undefined reference to `fst::FstHeader::Write(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::ReadFstKaldiGeneric(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)':
/home/kaldi-trunk/src/fstext/kaldi-fst-io.cc:57: undefined reference to `fst::FstHeader::Read(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/home/kaldi-trunk/src/fstext/kaldi-fst-io.cc:79: undefined reference to `fst::FstReadOptions::FstReadOptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, fst::FstHeader const*, fst::SymbolTable const*, fst::SymbolTable const*)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::ReadFstKaldi(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/kaldi-trunk/src/fstext/kaldi-fst-io.cc:34: undefined reference to `fst::FstHeader::Read(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/home/kaldi-trunk/src/fstext/kaldi-fst-io.cc:37: undefined reference to `fst::FstReadOptions::FstReadOptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, fst::FstHeader const*, fst::SymbolTable const*, fst::SymbolTable const*)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::Read(std::istream&, fst::FstReadOptions const&)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/fst.h:240: undefined reference to `fst::FstHeader::Read(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::FstRegister<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::ConvertKeyToSoFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/register.h:62: undefined reference to `fst::ConvertToLegalCSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::ReadHeader(std::istream&, fst::FstReadOptions const&, int, fst::FstHeader*)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/fst.h:797: undefined reference to `fst::FstHeader::Read(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::internal::ConstFstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> >, unsigned int>::Read(std::istream&, fst::FstReadOptions const&)':
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/const-fst.h:214: undefined reference to `fst::MappedFile::Map(std::istream*, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)'
/home/kaldi-trunk/tools/openfst-1.6.7/include/fst/const-fst.h:227: undefined reference to `fst::MappedFile::Map(std::istream*, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)'
collect2: error: ld returned 1 exit status
make[1]: *** [align-equal] Error 1
make[1]: Leaving directory `/home/kaldi-trunk/src/bin'
make: *** [bin] Error 2

  将gcc/g++降到5.4.0,依然报这个错,不能解决,换Ubuntu系统,过程在上面。

原文链接: https://www.cnblogs.com/mbyccheng/p/13718148.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    为kaldi安装GPU环境

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/203195

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月12日 下午9:25
下一篇 2023年2月12日 下午9:26

相关推荐