CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

CNTK+Kaldi plugin on RH7

Open mravanelli opened this issue 10 years ago • 8 comments

Hi, I'm trying to compile CNTK+kaldi plugin on linux (REDHAT 7). First of all I have downloaded the latest version of Kaldi and I've compiled it without errors. Unfortunately, when compiling CNTK I met an issue. In particular at this point:

mpic++ -c Source/Readers/Kaldi2Reader/HTKMLFWriter.cpp -o /home/mravanelli/CNTK-master/build/release/.build/Source/Readers/Kaldi2Reader/HTKMLFWriter.o -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -DUSE_CUDNN -DUSE_ACML -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -DHAVE_OPENFST_GE_10400 -DNDEBUG -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC -Werror -fcheck-new -Wno-error=literal-suffix -g -O4 -ISource/Common/Include -ISource/Math -ISource/CNTK -ISource/ActionsLib -ISource/ComputationNetworkLib -ISource/SGDLib -ISource/SequenceTrainingLib -ISource/CNTK/BrainScript -ISource/Readers/ReaderLib -I/usr/./include/nvidia/gdk -I/home/mravanelli/cub-1.4.1 -I/home/mravanelli/cuda-7.5/include -I/usr/local/cudnn-4.0/cuda/include -I/opt/acml5.3.1/ifort64_mp/include -I/home/mravanelli/kaldi-trunk/src -I/home/mravanelli/kaldi-trunk/tools/ATLAS/include -I/home/mravanelli/kaldi-trunk/tools/openfst/include -MD -MP -MF /home/mravanelli/CNTK-master/build/release/.build/Source/Readers/Kaldi2Reader/HTKMLFWriter.d

I have obtained the following error:

In file included from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/weight.h:82:0,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/pair-weight.h:29,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/expectation-weight.h:36,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/arc.h:28,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/fst.h:34,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/fstlib.h:49,
from /home/mravanelli/kaldi-trunk/src/fstext/lattice-utils.h:24,
from Source/Readers/Kaldi2Reader/kaldi.h:4,
from Source/Readers/Kaldi2Reader/htkfeatio.h:25,
from Source/Readers/Kaldi2Reader/DataWriter.cpp:11:
/home/mravanelli/kaldi-trunk/tools/openfst/include/fst/util.h:164:21: error: reference to ‘unordered_map’ is ambiguous
READ_STL_ASSOC_TYPE(unordered_map);
^
/home/mravanelli/kaldi-trunk/tools/openfst/include/fst/util.h:149:41: note: in definition of macro ‘READ_STL_ASSOC_TYPE’
inline istream &ReadType(istream &strm, C<S, T, U> *c) { \
^
In file included from /usr/include/c++/4.8.2/tr1/unordered_map:42:0,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/util.h:24,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/weight.h:82,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/pair-weight.h:29,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/expectation-weight.h:36,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/arc.h:28,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/fst.h:34,
from /home/mravanelli/kaldi-trunk/tools/openfst/include/fst/fstlib.h:49,
from /home/mravanelli/kaldi-trunk/src/fstext/lattice-utils.h:24,
from Source/Readers/Kaldi2Reader/kaldi.h:4,
from Source/Readers/Kaldi2Reader/htkfeatio.h:25,
from Source/Readers/Kaldi2Reader/DataWriter.cpp:11:
/usr/include/c++/4.8.2/tr1/unordered_map.h:180:11: note: candidates are: template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class std::tr1::unordered_map
class unordered_map
^
In file included from /usr/include/c++/4.8.2/unordered_map:48:0,
from Source/Readers/Kaldi2Reader/basetypes.h:27,
from Source/Readers/Kaldi2Reader/DataWriter.cpp:9:
/usr/include/c++/4.8.2/bits/unordered_map.h:97:11: note: template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class std::unordered_map
class unordered_map : __check_copy_constructible<_Alloc>

This is then followed by many other similar errors. This seems weird because I recently compiled CNTK with kaldi plugin on Ubuntu without any error.

Any idea?

Thank you!

mravanelli avatar Feb 15 '16 15:02 mravanelli

Hi mirco86,

We are using gcc 4.8.4. Could you try to compile with this compiler? It seems you have an older version. Thanks!

eldakms avatar Feb 15 '16 15:02 eldakms

I'm actually using gcc 4.8.5. Is this a problem?

gcc --version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) Copyright (C) 2015 Free Software Foundation, Inc.

ll /usr/include/c++

total 4 drwxr-xr-x. 12 root root 4096 Feb 10 13:54 4.8.2 lrwxrwxrwx. 1 root root 5 Feb 10 13:54 4.8.5 -> 4.8.2

(The /usr/include/c++/4.8.2/ you find in the log file is a folder created when installing gcc 4.8.5)

Mirco

On Mon, Feb 15, 2016 at 4:18 PM, eldakms [email protected] wrote:

Hi mirco86,

We are using gcc 4.8.4. Could you try to compile with this compiler? It seems you have an older version. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/Microsoft/CNTK/issues/119#issuecomment-184250364.

mravanelli avatar Feb 15 '16 16:02 mravanelli

@mirco86 I'm working around this problem, my email is [email protected]

hope we can communicate in depth

jren2012 avatar Feb 15 '16 21:02 jren2012

Do you already have an insight of the solution? In this case it would be good to share it with the other guys...

Mirco

On Mon, Feb 15, 2016 at 10:09 PM, JUN REN [email protected] wrote:

@mirco86 https://github.com/mirco86 I'm working around this problem, my email is [email protected]

hope we can communicate in depth

— Reply to this email directly or view it on GitHub https://github.com/Microsoft/CNTK/issues/119#issuecomment-184394934.

mravanelli avatar Feb 15 '16 21:02 mravanelli

it seems the unordered_map ends up being included twice. The first time around from openfst/include/fst/util.h:

#include <tr1/unordered_map> using std::tr1::unordered_map;

The second - from Kaldi2Reader/basetypes.h:

#include <unordered_map> ... using namespace std; // Ugh!

raaaar avatar Feb 15 '16 22:02 raaaar

I solved the compilation issue by strictly following the instruction written in the "KaldiReaderReadme" file:

  1. In kaldi-trunk/tools/Makefile, uncomment # OPENFST_VERSION = 1.4.1, and re-install OpenFst using the makefile.
  2. In kaldi-trunk/src/, do ./configure --shared; make depend -j 8; make -j 8; and re-compile Kaldi (the -j option is for parallelization).

If you don't follow it, there are the compilation problem described above.

Mirco

On Mon, Feb 15, 2016 at 11:11 PM, raaaar [email protected] wrote:

it seems the unordered_map ends up being included twice. The first time around from openfst/include/fst/util.h:

#include <tr1/unordered_map> using std::tr1::unordered_map;

The second - from Kaldi2Reader/basetypes.h:

#include <unordered_map> ... using namespace std; // Ugh!

— Reply to this email directly or view it on GitHub https://github.com/Microsoft/CNTK/issues/119#issuecomment-184416475.

mravanelli avatar Feb 16 '16 13:02 mravanelli

It seems like this issue is resolved. Please re-open if it still reproes, and provide the latest context.

mradmila avatar Mar 14 '16 23:03 mradmila

Hi, I had the same problem and solved it by updating openfst to 1.6.2. hope that helps anyone who faces the same issue.

ghost avatar Apr 26 '17 10:04 ghost