diff --git a/paddle/fluid/operators/listen_and_serv_op.cc b/paddle/fluid/operators/listen_and_serv_op.cc index b0eec2eb443e2e9a42c5adad7bdff4d97fbbba19..463677c75e2b99503f62983f32a2dcc6ff5a278c 100644 --- a/paddle/fluid/operators/listen_and_serv_op.cc +++ b/paddle/fluid/operators/listen_and_serv_op.cc @@ -269,16 +269,16 @@ void ListenAndServOp::RunImpl(const framework::Scope &scope, rpc_service_->RegisterRPC(detail::kRequestCheckpoint, request_checkpoint_handler_.get()); + auto *optimize_block = Attr(kOptimizeBlock); + auto *program = optimize_block->Program(); + framework::Executor executor(dev_place); + std::shared_ptr ckpt_pre_context = nullptr; if (checkpoint_notify_id != -1) { auto ctx = executor.Prepare(*program, checkpoint_notify_id); ckpt_pre_context = std::move(ctx); } - auto *optimize_block = Attr(kOptimizeBlock); - auto *program = optimize_block->Program(); - framework::Executor executor(dev_place); - // prepare for prefetch std::vector prefetch_block_id_list; std::unordered_map block_id_to_prefetch_var_name;