don't store hypo and vocab index in NthOutBatch

This commit is contained in:
Hieu Hoang 2018-01-19 13:36:11 +00:00
parent 8ca6783e2b
commit 736e18ad5f
3 changed files with 21 additions and 21 deletions

View File

@ -215,8 +215,8 @@ void BestHyps::CalcBeam(
std::vector<unsigned> batchMap = histories.Hypo2Batch();
//cerr << "CalcBeam8" << endl;
//cerr << "batchMap=" << Debug(batchMap, 2) << endl;
cerr << "bestKeys=" << amunmt::Debug(bestKeys, 2) << endl;
cerr << "Probs=" << Probs.Debug(0) << endl;
//cerr << "bestKeys=" << amunmt::Debug(bestKeys, 2) << endl;
//cerr << "Probs=" << Probs.Debug(0) << endl;
for (unsigned i = 0; i < numHypos; i++) {
//cerr << "CalcBeam9=" << i << endl;

View File

@ -1395,13 +1395,13 @@ void LogSoftmaxAndNBest(mblas::Vector<NthOutBatch> &nBest,
mblas::Vector<NthOutBatch> nBestCandidates(candidateInd);
//PAUSE_TIMER("LogSoftmaxAndNBest excl kernels");
HANDLE_ERROR( cudaStreamSynchronize(mblas::CudaStreamHandler::GetStream()));
cerr << "d_isFirsts=" << d_isFirsts.Debug(2) << endl;
cerr << "d_beamSizes=" << d_beamSizes.Debug(2) << endl;
cerr << "hypo2BeamSize=" << hypo2BeamSize.Debug(2) << endl;
cerr << "hypo2Candidate=" << hypo2Candidate.Debug(2) << endl;
cerr << "hypo2NextHypo=" << hypo2NextHypo.Debug(2) << endl;
cerr << "activeBatch2Hypo=" << activeBatch2Hypo.Debug(2) << endl;
//HANDLE_ERROR( cudaStreamSynchronize(mblas::CudaStreamHandler::GetStream()));
//cerr << "d_isFirsts=" << d_isFirsts.Debug(2) << endl;
//cerr << "d_beamSizes=" << d_beamSizes.Debug(2) << endl;
//cerr << "hypo2BeamSize=" << hypo2BeamSize.Debug(2) << endl;
//cerr << "hypo2Candidate=" << hypo2Candidate.Debug(2) << endl;
//cerr << "hypo2NextHypo=" << hypo2NextHypo.Debug(2) << endl;
//cerr << "activeBatch2Hypo=" << activeBatch2Hypo.Debug(2) << endl;
//BEGIN_TIMER("gBeamSizeInit");
gBeamSizeInit<<<1, 1, 0, CudaStreamHandler::GetStream()>>>
@ -1430,8 +1430,8 @@ void LogSoftmaxAndNBest(mblas::Vector<NthOutBatch> &nBest,
hypo2Candidate);
//PAUSE_TIMER("gLogSoftMax");
HANDLE_ERROR( cudaStreamSynchronize(mblas::CudaStreamHandler::GetStream()));
cerr << "nBestCandidates=" << nBestCandidates.Debug(2) << endl;
//HANDLE_ERROR( cudaStreamSynchronize(mblas::CudaStreamHandler::GetStream()));
//cerr << "nBestCandidates=" << nBestCandidates.Debug(2) << endl;
blocks = std::min(MAX_BLOCKS, activeBatchSize);
/*

View File

@ -41,8 +41,8 @@ struct NthOutBatch
{
unsigned ind;
float score;
unsigned hypoInd;
unsigned vocabInd;
//unsigned hypoInd;
//unsigned vocabInd;
__device__ __host__
NthOutBatch(const float& rhs)
@ -51,8 +51,8 @@ struct NthOutBatch
assert(rhs == 0.0f);
ind = rhs;
score = rhs;
hypoInd = rhs;
vocabInd = rhs;
//hypoInd = rhs;
//vocabInd = rhs;
}
__device__ __host__
@ -62,8 +62,8 @@ struct NthOutBatch
NthOutBatch(unsigned vInd, float vScore, unsigned vHypoInd, unsigned vVocabInd)
:ind(vInd)
,score(vScore)
,hypoInd(vHypoInd)
,vocabInd(vVocabInd)
//,hypoInd(vHypoInd)
//,vocabInd(vVocabInd)
{}
__device__ __host__
@ -71,8 +71,8 @@ struct NthOutBatch
{
ind = rhs.ind;
score = rhs.score;
hypoInd = rhs.hypoInd;
vocabInd = rhs.vocabInd;
//hypoInd = rhs.hypoInd;
//vocabInd = rhs.vocabInd;
return *this;
}
@ -102,8 +102,8 @@ inline std::ostream& operator<<(std::ostream &out, const NthOutBatch &obj)
out << "("
<< obj.ind << ","
<< obj.score << ","
<< obj.hypoInd << ","
<< obj.vocabInd
//<< obj.hypoInd << ","
//<< obj.vocabInd
<< ")";
return out;
}