зеркало из https://github.com/mozilla/kaldi.git
merge Makefile changes from ^/sandbox/sail; fix to ApplyExp() in cudamatrix [thanks to Vijayaditya Peddinti]
git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@3720 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Коммит
6396239ea7
|
@ -451,7 +451,7 @@ function linux_check_dynamic {
|
|||
echo "Atlas found in $dir";
|
||||
return 0;
|
||||
else
|
||||
echo "No libatlas.so in $dir";
|
||||
echo "... no libatlas.so in $dir";
|
||||
return 1;
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -276,8 +276,8 @@ static void _copy_col_from_vec(Real* mat, const Real* v, int col, MatrixDim d) {
|
|||
template<typename Real>
|
||||
__global__
|
||||
static void _apply_exp(Real* mat, MatrixDim d) {
|
||||
int32_cuda i = blockIdx.y * blockDim.y + threadIdx.y;
|
||||
int32_cuda j = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
int32_cuda i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
int32_cuda j = blockIdx.y * blockDim.y + threadIdx.y;
|
||||
int32_cuda index = i + j * d.stride;
|
||||
if ( i < d.cols && j < d.rows ) {
|
||||
mat[index] = exp(mat[index]);
|
||||
|
|
|
@ -143,6 +143,28 @@ static void UnitTestCuMatrixApplyLog() {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* CuMatrix
|
||||
*/
|
||||
template<typename Real>
|
||||
static void UnitTestCuMatrixApplyExp() {
|
||||
int32 M = 100 + rand() % 200, N = 100 + rand() % 200;
|
||||
Matrix<Real> H(M, N);
|
||||
H.SetRandn();
|
||||
H.MulElements(H); // make numbers positive
|
||||
|
||||
CuMatrix<Real> D(H);
|
||||
|
||||
D.ApplyExp();
|
||||
H.ApplyExp();
|
||||
|
||||
Matrix<Real> H2(D);
|
||||
|
||||
AssertEqual(H,H2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename Real>
|
||||
static void UnitTestCuMatrixSigmoid() {
|
||||
for (int32 i = 0; i < 3; i++) {
|
||||
|
@ -1852,6 +1874,7 @@ template<typename Real> void CudaMatrixUnitTest() {
|
|||
UnitTestCuMatrixCopyCross<Real>();
|
||||
UnitTestCuMatrixCopyCross2<Real>();
|
||||
UnitTestCuMatrixApplyLog<Real>();
|
||||
UnitTestCuMatrixApplyExp<Real>();
|
||||
UnitTestCuMatrixSetRandn<Real>();
|
||||
UnitTestCuMatrixSetRandUniform<Real>();
|
||||
UnitTestCuMatrixScale<Real>();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# SHELL += -x
|
||||
|
||||
CXX ?= g++
|
||||
CXXFLAGS ?=
|
||||
LDFLAGS ?=
|
||||
CXX = g++
|
||||
|
||||
# On Mac OS 10.9, g++ is actually clang in disguise which by default uses the
|
||||
# new c++ standard library libc++. Since openfst uses stuff from the tr1
|
||||
|
@ -12,7 +10,7 @@ ifeq ($(findstring clang,$(COMPILER)),clang)
|
|||
CXXFLAGS += -stdlib=libstdc++
|
||||
LDFLAGS += -stdlib=libstdc++
|
||||
endif
|
||||
|
||||
|
||||
all: check_required_programs sph2pipe atlas irstlm_tgt sclite_tgt openfst_tgt
|
||||
|
||||
|
||||
|
@ -109,7 +107,7 @@ irstlm_tgt: irstlm_compiled
|
|||
.PHONY: irstlm_compiled
|
||||
irstlm_compiled: irstlm/Makefile
|
||||
cd irstlm/; \
|
||||
$(MAKE); $(MAKE) install
|
||||
make; $(MAKE) install
|
||||
|
||||
irstlm/Makefile: irstlm/.patched
|
||||
cd irstlm; \
|
||||
|
@ -123,7 +121,7 @@ irstlm/.patched: | irstlm
|
|||
-cd irstlm;\
|
||||
patch --verbose -N -p0 < ../interpolatedwrite-5.60.02.patch; \
|
||||
patch --verbose -N -p0 < ../irstlm.patch; \
|
||||
touch $@
|
||||
touch .patched
|
||||
|
||||
irstlm:
|
||||
svn -r 398 co --non-interactive --trust-server-cert https://svn.code.sf.net/p/irstlm/code/trunk irstlm
|
||||
|
|
Загрузка…
Ссылка в новой задаче