From 490482aeb1f3150413b99c78fae8c6a920975649 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Fri, 15 Sep 2017 18:54:00 -0700 Subject: [PATCH] Do not invoke GPU method when use_gpu=false --- .../gserver/gradientmachines/RecurrentGradientMachine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp b/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp index 9f29b9746..b71431b90 100644 --- a/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp +++ b/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp @@ -18,6 +18,7 @@ limitations under the License. */ #include #include #include +#include #include "NeuralNetwork.h" #include "paddle/gserver/layers/AgentLayer.h" #include "paddle/utils/Flags.h" @@ -429,7 +430,11 @@ void RecurrentGradientMachine::reorganizeInput(PassType passType) { } { - AsyncGpuBlock asyncGpuBlock; + std::unique_ptr asyncBlock; + + if (useGpu_) { + asyncBlock.reset(new AsyncGpuBlock()); + } // inFrameLine select rows in real layer one time for (size_t i = 0; i < inFrameLines_.size(); i++) { -- GitLab