Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2018-01-12 01:07:04 +0300
committerHieu Hoang <hieuhoang@gmail.com>2018-01-12 01:07:04 +0300
commit85c9b02f6ca05817d1dc2d62f58c841a57767153 (patch)
treed56e02c2073a4ed02d5cf0a8488bce27cc9a8c4d
parent72c2caa4055b08b97c5162d268683cee92d12cf4 (diff)
use copyFrom
-rw-r--r--src/amun/gpu/decoder/encoder_decoder.cu7
-rw-r--r--src/amun/gpu/dl4mt/decoder.h21
2 files changed, 4 insertions, 24 deletions
diff --git a/src/amun/gpu/decoder/encoder_decoder.cu b/src/amun/gpu/decoder/encoder_decoder.cu
index 1444e240..b3c8c75f 100644
--- a/src/amun/gpu/decoder/encoder_decoder.cu
+++ b/src/amun/gpu/decoder/encoder_decoder.cu
@@ -379,12 +379,7 @@ void EncoderDecoder::AssembleBeamState(const Histories& histories,
EDState& edOutState = outState.get<EDState>();
thread_local mblas::Vector<unsigned> indices;
- indices.newSize(beamStateIds.size());
-
- mblas::copy(beamStateIds.data(),
- beamStateIds.size(),
- indices.data(),
- cudaMemcpyHostToDevice);
+ indices.copyFrom(beamStateIds);
CellState& cellOutStates = edOutState.GetStates();
const CellState& cellInstates = edInState.GetStates();
diff --git a/src/amun/gpu/dl4mt/decoder.h b/src/amun/gpu/dl4mt/decoder.h
index 019de992..40dbe428 100644
--- a/src/amun/gpu/dl4mt/decoder.h
+++ b/src/amun/gpu/dl4mt/decoder.h
@@ -34,12 +34,7 @@ private:
id = 1;
}
}
- indices_.newSize(tids.size());
-
- mblas::copy(tids.data(),
- tids.size(),
- indices_.data(),
- cudaMemcpyHostToDevice);
+ indices_.copyFrom(tids);
Assemble(Rows, *w_.E_, indices_);
}
@@ -61,12 +56,7 @@ private:
id = 1;
}
}
- indices_.newSize(tids.size());
-
- mblas::copy(tids.data(),
- tids.size(),
- indices_.data(),
- cudaMemcpyHostToDevice);
+ indices_.copyFrom(tids);
AssembleTopup(Rows, *w_.E_, indices_, numHypos, d_oldHypoIds);
@@ -216,12 +206,7 @@ private:
unsigned batchSize = SourceContext.dim(3);
std::vector<unsigned> hypo2Batch = histories.Hypo2Batch();
- dHypo2Batch_.newSize(hypo2Batch.size());
-
- mblas::copy(hypo2Batch.data(),
- hypo2Batch.size(),
- dHypo2Batch_.data(),
- cudaMemcpyHostToDevice);
+ dHypo2Batch_.copyFrom(hypo2Batch);
TIME_CMD("Prod3", Prod(/*h_[1],*/ Temp2_, *(HiddenState.output), *w_.W_));