зеркало из 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";
|
echo "Atlas found in $dir";
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
echo "No libatlas.so in $dir";
|
echo "... no libatlas.so in $dir";
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,8 +276,8 @@ static void _copy_col_from_vec(Real* mat, const Real* v, int col, MatrixDim d) {
|
||||||
template<typename Real>
|
template<typename Real>
|
||||||
__global__
|
__global__
|
||||||
static void _apply_exp(Real* mat, MatrixDim d) {
|
static void _apply_exp(Real* mat, MatrixDim d) {
|
||||||
int32_cuda i = blockIdx.y * blockDim.y + threadIdx.y;
|
int32_cuda i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
int32_cuda j = blockIdx.x * blockDim.x + threadIdx.x;
|
int32_cuda j = blockIdx.y * blockDim.y + threadIdx.y;
|
||||||
int32_cuda index = i + j * d.stride;
|
int32_cuda index = i + j * d.stride;
|
||||||
if ( i < d.cols && j < d.rows ) {
|
if ( i < d.cols && j < d.rows ) {
|
||||||
mat[index] = exp(mat[index]);
|
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>
|
template<typename Real>
|
||||||
static void UnitTestCuMatrixSigmoid() {
|
static void UnitTestCuMatrixSigmoid() {
|
||||||
for (int32 i = 0; i < 3; i++) {
|
for (int32 i = 0; i < 3; i++) {
|
||||||
|
@ -1852,6 +1874,7 @@ template<typename Real> void CudaMatrixUnitTest() {
|
||||||
UnitTestCuMatrixCopyCross<Real>();
|
UnitTestCuMatrixCopyCross<Real>();
|
||||||
UnitTestCuMatrixCopyCross2<Real>();
|
UnitTestCuMatrixCopyCross2<Real>();
|
||||||
UnitTestCuMatrixApplyLog<Real>();
|
UnitTestCuMatrixApplyLog<Real>();
|
||||||
|
UnitTestCuMatrixApplyExp<Real>();
|
||||||
UnitTestCuMatrixSetRandn<Real>();
|
UnitTestCuMatrixSetRandn<Real>();
|
||||||
UnitTestCuMatrixSetRandUniform<Real>();
|
UnitTestCuMatrixSetRandUniform<Real>();
|
||||||
UnitTestCuMatrixScale<Real>();
|
UnitTestCuMatrixScale<Real>();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# SHELL += -x
|
# SHELL += -x
|
||||||
|
|
||||||
CXX ?= g++
|
CXX = g++
|
||||||
CXXFLAGS ?=
|
|
||||||
LDFLAGS ?=
|
|
||||||
|
|
||||||
# On Mac OS 10.9, g++ is actually clang in disguise which by default uses the
|
# 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
|
# new c++ standard library libc++. Since openfst uses stuff from the tr1
|
||||||
|
@ -12,7 +10,7 @@ ifeq ($(findstring clang,$(COMPILER)),clang)
|
||||||
CXXFLAGS += -stdlib=libstdc++
|
CXXFLAGS += -stdlib=libstdc++
|
||||||
LDFLAGS += -stdlib=libstdc++
|
LDFLAGS += -stdlib=libstdc++
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: check_required_programs sph2pipe atlas irstlm_tgt sclite_tgt openfst_tgt
|
all: check_required_programs sph2pipe atlas irstlm_tgt sclite_tgt openfst_tgt
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ irstlm_tgt: irstlm_compiled
|
||||||
.PHONY: irstlm_compiled
|
.PHONY: irstlm_compiled
|
||||||
irstlm_compiled: irstlm/Makefile
|
irstlm_compiled: irstlm/Makefile
|
||||||
cd irstlm/; \
|
cd irstlm/; \
|
||||||
$(MAKE); $(MAKE) install
|
make; $(MAKE) install
|
||||||
|
|
||||||
irstlm/Makefile: irstlm/.patched
|
irstlm/Makefile: irstlm/.patched
|
||||||
cd irstlm; \
|
cd irstlm; \
|
||||||
|
@ -123,7 +121,7 @@ irstlm/.patched: | irstlm
|
||||||
-cd irstlm;\
|
-cd irstlm;\
|
||||||
patch --verbose -N -p0 < ../interpolatedwrite-5.60.02.patch; \
|
patch --verbose -N -p0 < ../interpolatedwrite-5.60.02.patch; \
|
||||||
patch --verbose -N -p0 < ../irstlm.patch; \
|
patch --verbose -N -p0 < ../irstlm.patch; \
|
||||||
touch $@
|
touch .patched
|
||||||
|
|
||||||
irstlm:
|
irstlm:
|
||||||
svn -r 398 co --non-interactive --trust-server-cert https://svn.code.sf.net/p/irstlm/code/trunk irstlm
|
svn -r 398 co --non-interactive --trust-server-cert https://svn.code.sf.net/p/irstlm/code/trunk irstlm
|
||||||
|
|
Загрузка…
Ссылка в новой задаче