Skip to content

Fixes to CUDA problems introduced by recent commits: normalize code c…#1228

Merged
danpovey merged 1 commit intokaldi-asr:masterfrom
danpovey:cuda_fix
Nov 30, 2016
Merged

Fixes to CUDA problems introduced by recent commits: normalize code c…#1228
danpovey merged 1 commit intokaldi-asr:masterfrom
danpovey:cuda_fix

Conversation

@danpovey
Copy link
Contributor

…rashed on zero; compile problem on nvcc 8.0.

…de crash; compile problem on nvcc 8.0; fix thread-sync errors.
@danpovey danpovey merged commit 87465f5 into kaldi-asr:master Nov 30, 2016
ssum[tid] += ssum[tid + shift];
__syncthreads();
}
__syncthreads();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad… I missed this sync bug in unit test.

void NormalizePerRow(const CuMatrixBase<Real>& in, const Real target_rms,
const bool add_log_stddev, CuMatrixBase<Real>* out) {
const Real kSquaredNormFloor = 1.35525271560688e-20; // 2^-66
KALDI_ASSERT(SameDim(in, *out));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not hold if add_log_stddev is true.



inline __device__ static float max_generic(float a, float b) {
return fmaxf(a, b);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Math functions such as fmax() are already overloaded for both double and float as documented here. http://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH.html#group__CUDA__MATH

It seems that max() has been overloaded for all possible types in this header but this is not documented.
/usr/local/cuda/include/math_functions.h

@danpovey
Copy link
Contributor Author

danpovey commented Nov 30, 2016 via email

@kangshiyin
Copy link
Contributor

I will make a PR soon. I think renorm in relu+renorm+sreg stands for NormalizeComponent, which is being used by @GaofengCheng in the experiment?

@GaofengCheng
Copy link
Contributor

@kangshiyin NormalizeComponent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants