From ba6a7c3ac2c3a4bd49b58473b6c7a7e4fe94b836 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Fri, 2 Sep 2016 23:27:11 +0100 Subject: [PATCH] move to gpu --- amunmt/.project | 60 +++++++++++++++++++++++--- src/CMakeLists.txt | 4 +- src/decoder/ape_penalty.h | 2 +- src/decoder/encoder_decoder.cu | 4 +- src/decoder/encoder_decoder.h | 2 +- src/dl4mt/dl4mt.h | 5 --- src/{ => gpu}/dl4mt/decoder.h | 6 +-- src/gpu/dl4mt/dl4mt.h | 5 +++ src/{ => gpu}/dl4mt/encoder.h | 6 +-- src/{ => gpu}/dl4mt/gru.cu | 0 src/{ => gpu}/dl4mt/gru.h | 4 +- src/{ => gpu}/dl4mt/model.h | 2 +- src/{ => gpu}/mblas/matrix.cu | 0 src/{ => gpu}/mblas/matrix.h | 0 src/{ => gpu}/mblas/thrust_functions.h | 0 15 files changed, 75 insertions(+), 25 deletions(-) delete mode 100644 src/dl4mt/dl4mt.h rename src/{ => gpu}/dl4mt/decoder.h (99%) create mode 100644 src/gpu/dl4mt/dl4mt.h rename src/{ => gpu}/dl4mt/encoder.h (97%) rename src/{ => gpu}/dl4mt/gru.cu (100%) rename src/{ => gpu}/dl4mt/gru.h (98%) rename src/{ => gpu}/dl4mt/model.h (99%) rename src/{ => gpu}/mblas/matrix.cu (100%) rename src/{ => gpu}/mblas/matrix.h (100%) rename src/{ => gpu}/mblas/thrust_functions.h (100%) diff --git a/amunmt/.project b/amunmt/.project index 89bb96bf..cd5d963f 100644 --- a/amunmt/.project +++ b/amunmt/.project @@ -50,11 +50,6 @@ 2 virtual:/virtual - - mblas - 2 - PARENT-1-PROJECT_LOC/src/mblas - yaml-cpp 2 @@ -210,6 +205,16 @@ 1 PARENT-1-PROJECT_LOC/src/common/vocab.h + + gpu/dl4mt + 2 + virtual:/virtual + + + gpu/mblas + 2 + virtual:/virtual + gpu/npz_converter.cu 1 @@ -580,6 +585,51 @@ 1 PARENT-1-PROJECT_LOC/src/yaml-cpp/yaml.h + + gpu/dl4mt/decoder.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/decoder.h + + + gpu/dl4mt/dl4mt.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/dl4mt.h + + + gpu/dl4mt/encoder.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/encoder.h + + + gpu/dl4mt/gru.cu + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/gru.cu + + + gpu/dl4mt/gru.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/gru.h + + + gpu/dl4mt/model.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/dl4mt/model.h + + + gpu/mblas/matrix.cu + 1 + PARENT-1-PROJECT_LOC/src/gpu/mblas/matrix.cu + + + gpu/mblas/matrix.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/mblas/matrix.h + + + gpu/mblas/thrust_functions.h + 1 + PARENT-1-PROJECT_LOC/src/gpu/mblas/thrust_functions.h + yaml-cpp/contrib/anchordict.h 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0dd6fbaf..58d13552 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,8 +38,8 @@ cuda_add_executable( common/scorer.cpp common/search.cpp common/sentence.cpp - mblas/matrix.cu - dl4mt/gru.cu + gpu/mblas/matrix.cu + gpu/dl4mt/gru.cu $ $ $ diff --git a/src/decoder/ape_penalty.h b/src/decoder/ape_penalty.h index 7e52e059..70e79577 100644 --- a/src/decoder/ape_penalty.h +++ b/src/decoder/ape_penalty.h @@ -5,7 +5,7 @@ #include "types.h" #include "file_stream.h" #include "scorer.h" -#include "matrix.h" +#include "gpu/mblas/matrix.h" #include "loader.h" typedef std::vector SrcTrgMap; diff --git a/src/decoder/encoder_decoder.cu b/src/decoder/encoder_decoder.cu index 52e76d83..1a55e383 100644 --- a/src/decoder/encoder_decoder.cu +++ b/src/decoder/encoder_decoder.cu @@ -1,6 +1,6 @@ #include "encoder_decoder.h" -#include "matrix.h" -#include "god.h" +#include "gpu/mblas/matrix.h" +#include "common/god.h" mblas::Matrix& EncoderDecoderState::GetStates() { return states_; diff --git a/src/decoder/encoder_decoder.h b/src/decoder/encoder_decoder.h index f9f12403..8ed66d86 100644 --- a/src/decoder/encoder_decoder.h +++ b/src/decoder/encoder_decoder.h @@ -5,7 +5,7 @@ #include "scorer.h" #include "loader.h" -#include "dl4mt.h" +#include "gpu/dl4mt/dl4mt.h" #include "threadpool.h" diff --git a/src/dl4mt/dl4mt.h b/src/dl4mt/dl4mt.h deleted file mode 100644 index 380928e1..00000000 --- a/src/dl4mt/dl4mt.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "dl4mt/model.h" -#include "dl4mt/encoder.h" -#include "dl4mt/decoder.h" diff --git a/src/dl4mt/decoder.h b/src/gpu/dl4mt/decoder.h similarity index 99% rename from src/dl4mt/decoder.h rename to src/gpu/dl4mt/decoder.h index ada0cad6..8a8e4029 100644 --- a/src/dl4mt/decoder.h +++ b/src/gpu/dl4mt/decoder.h @@ -1,8 +1,8 @@ #pragma once -#include "mblas/matrix.h" -#include "dl4mt/model.h" -#include "dl4mt/gru.h" +#include "../mblas/matrix.h" +#include "model.h" +#include "gru.h" class Decoder { private: diff --git a/src/gpu/dl4mt/dl4mt.h b/src/gpu/dl4mt/dl4mt.h new file mode 100644 index 00000000..b56c575d --- /dev/null +++ b/src/gpu/dl4mt/dl4mt.h @@ -0,0 +1,5 @@ +#pragma once + +#include "model.h" +#include "encoder.h" +#include "decoder.h" diff --git a/src/dl4mt/encoder.h b/src/gpu/dl4mt/encoder.h similarity index 97% rename from src/dl4mt/encoder.h rename to src/gpu/dl4mt/encoder.h index 0484518b..e63642e2 100644 --- a/src/dl4mt/encoder.h +++ b/src/gpu/dl4mt/encoder.h @@ -1,8 +1,8 @@ #pragma once -#include "mblas/matrix.h" -#include "dl4mt/model.h" -#include "dl4mt/gru.h" +#include "../mblas/matrix.h" +#include "model.h" +#include "gru.h" class Encoder { private: diff --git a/src/dl4mt/gru.cu b/src/gpu/dl4mt/gru.cu similarity index 100% rename from src/dl4mt/gru.cu rename to src/gpu/dl4mt/gru.cu diff --git a/src/dl4mt/gru.h b/src/gpu/dl4mt/gru.h similarity index 98% rename from src/dl4mt/gru.h rename to src/gpu/dl4mt/gru.h index 00612f1c..052070f2 100644 --- a/src/dl4mt/gru.h +++ b/src/gpu/dl4mt/gru.h @@ -1,6 +1,6 @@ #pragma once -#include "mblas/matrix.h" +#include "../mblas/matrix.h" template class SlowGRU { @@ -145,4 +145,4 @@ class FastGRU { }; template -using GRU = FastGRU; \ No newline at end of file +using GRU = FastGRU; diff --git a/src/dl4mt/model.h b/src/gpu/dl4mt/model.h similarity index 99% rename from src/dl4mt/model.h rename to src/gpu/dl4mt/model.h index 3bf5c282..b37ea135 100644 --- a/src/dl4mt/model.h +++ b/src/gpu/dl4mt/model.h @@ -3,7 +3,7 @@ #include #include -#include "mblas/matrix.h" +#include "../mblas/matrix.h" #include "gpu/npz_converter.h" struct Weights { diff --git a/src/mblas/matrix.cu b/src/gpu/mblas/matrix.cu similarity index 100% rename from src/mblas/matrix.cu rename to src/gpu/mblas/matrix.cu diff --git a/src/mblas/matrix.h b/src/gpu/mblas/matrix.h similarity index 100% rename from src/mblas/matrix.h rename to src/gpu/mblas/matrix.h diff --git a/src/mblas/thrust_functions.h b/src/gpu/mblas/thrust_functions.h similarity index 100% rename from src/mblas/thrust_functions.h rename to src/gpu/mblas/thrust_functions.h