forked from kaldi-asr/kaldi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
146 lines (118 loc) · 6.29 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Installation instructions for native Windows with Visual
# studio (for cygwin installation, see the instructions
# in ../INSTALL).
#NOTE: These instructions are valid June 2015, MKL and OpenBLAS are supported
#NOTE: ATLAS is not supported and I personally have no intention to work on supporting
# it, as it requires whole cygwin environment
#NOTE: We now (20150613) support CUDA on Windows as well. The build was
# tested on CUDA 7.0. It is possible that the compilation fails
# for significantly older CUDA SDK (less than, say, 5.0)
# Please not that CUDA support for windows is not really that usefull,
# because, the speed benefit during decoding is not large. And for training
# one would have to re-implement the while training pipeline (as the
# bash script wouldn't most probably work)
#NOTE: While the 32bit project files will still be generated, we don't really
# care if they work or not. They will be removed in the near future.
#NOTE: The build process were validated using MSVS2013 and partially (MKL only) using MSVS2015-rc
#NOTE: We support only openfst-1.3.x for now.
#NOTE: I suggest to have git installed -- not only because we will
# use it to download the source codes (you could download archives
# instead of it), but also because the windows version comes
# with a bunch of useful utilities.
#NOTE: The examples will assume you have installed the git for windows
# and during the installation you chose the GIT Shell to install as well.
# Moreover, all the commands are issued from the same session
1) Checkout Kaldi trunk, either using the svn from the url
https://svn.code.sf.net/p/kaldi/code/trunk
or using git from
https://github.com/kaldi-asr/kaldi.git
Example:
$ git clone https://github.com/kaldi-asr/kaldi.git kaldi
2) enter the (kaldi)/tools directory in the freshly
checked-out kaldi repo. All following actions should
be taken in the tools dir
Example:
$ cd (kaldi)/tools
(kaldi)/tools$ pwd
2a) Use git to clone the OpenFST(win) from
https://github.com/jtrmal/openfstwin-1.3.4.git
Example:
(kaldi)/tools$ git clone https://github.com/jtrmal/openfstwin-1.3.4.git openfst
2b) Download pthread-win32 (or wget or curl)
https://sourceforge.net/projects/pthreads4w/
(kaldi)/tools$ wget http://downloads.sourceforge.net/project/pthreads4w/pthreads-w32-2-9-1-release.zip
(kaldi)/tools$ mkdir pthreads; cd pthreads
(kaldi)/tools/pthreads$ unzip ../pthreads-w32-2-9-1-release.zip
2c) Use patch (or you can use git patch) to patch the OpenFST(win)
patch location tools/extras/openfstwin-1.3.4.patch,
Example:
(kaldi)/tools$ cd openfst
(kaldi)/tools/openfst$ patch -p1 <../extras/openfstwin-1.3.4.patch
2d-1) Download the OpenBLAS binary packages
https://sourceforge.net/projects/openblas
(kaldi)/tools$ wget http://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int32.zip
(kaldi)/tools$ wget http://sourceforge.net/projects/openblas/files/v0.2.14/mingw64_dll.zip
(kaldi)/tools$ unzip OpenBLAS-v0.2.14-Win64-int32.zip
(kaldi)/tools$ unzip mingw64_dll.zip
NOTE: Be carefull to download "Win64-int32" and not "Win64-int64"!
2d-2) Install MKL
2e) If you want enabled CUDA support, download and install NVidia CUDA SDK.
Be careful and strive for as standard install as possible. The installer
set certain environment variables on which the MSVC Build rules rely.
If you call "set" in the command line, you should see:
(kaldi)/tools $ set | grep CUDA
CUDA_PATH='C:\Users\Yenda\Downloads\cuda'
CUDA_PATH_V7_0='C:\Users\Yenda\Downloads\cuda'
NVCUDASAMPLES7_0_ROOT='C:\Users\Yenda\Downloads\cuda'
NVCUDASAMPLES_ROOT='C:\Users\Yenda\Downloads\cuda'
The first one (CUDA_PATH) is particulary important.
3) Open the OpenFST solution in VS --
for VS 2013, the correct solution is in VS2012 directory
for VS 2014, the correct solution is in VS2014 directory
!!!switch the configuration to debug|x64 and build the solution
!!!The same for configuration release|x64
If either of the two won't build, you should stop here and start figuring what's different!
4) Enter the (kaldi)/windows directory
Example:
(kaldi)/tools/openfst$ cd ../../windows
(kaldi)/windows $ pwd
4a) modify the file variables.props to reflect
the correct paths, using your favorite text editor.
Don't worry, it's a text file, even though you have to be
careful to keep the structure itself intact
(kaldi)/windows $ vim variables.props
If you plan to use MKL, you can ignore the OPENBLASDIR path
If you plan to use OpenBLAS, you can ignore the MKLDIR path
No matter what you plan to use, set both the OPENFST* and PTHREADW
variables correctly
4b-1) For OpenBLAS support, copy the file "kaldiwin_openblas.props" to "kaldiwin.props"
4b-2) For MKL support, you don't have to do anything, it should work out of the box.
When you need to switch from OpenBLAS to MKL, copy the "kaldiwin_mkl.props"
to "kaldiwin.props"
4c) call the script that generates the MSVC solution
i.e.
generate_solution.pl --vsver <default|vs2013|vs2015>
i.e. for example
generate_solution.pl --vsver vs2013
For CUDA support, add switch --enable-cuda to the command line,
i.e. for example
generate_solution.pl --vsver vs2013 --enable-cuda
5) Open the generated solution in the visual studio and switch to Debug|x64 (or Release|x64) and build
Expect 10 projects to fail, majority of them will fail because of missing include "portaudio.h"
------
NOTE: I'm leaving the information about ATLAS here, for reference (also do not forget to consult the README.ATLAS)
(B) either
(i) compile ATLAS under cygwin [see INSTALL.atlas] and copy
kaldiwin_atlas.props to kaldiwin.props
(D)
If you had installed ATLAS, you next have to do this:
[assuming you are one level above this directory]
cd kaldiwin_vs10_auto/
# type the following (these commands were done from cygwin): note that these
# commands are a bit wasteful of disk; you could alternatively ensure that
# [root]/tools/ATLAS/cygwin_build/install/lib/ is always on your path when you
# run the binaries.
mkdir -p Debug Release
cp ../tools/ATLAS/cygwin_build/install/lib/lib_atlas.dll Debug
cp ../tools/ATLAS/cygwin_build/install/lib/lib_atlas.dll Release
Then build the project with Visual Studio.