Skip to content

Commit c83dd9b

Browse files
authored
Merge pull request #9336 from typhoonzero/fix_dist_compile
fix dist compile
2 parents 76ae540 + bf66ce0 commit c83dd9b

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

paddle/fluid/operators/detail/grpc_server.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ limitations under the License. */
2222
#include "paddle/fluid/framework/selected_rows.h"
2323
#include "paddle/fluid/framework/var_type.h"
2424
#include "paddle/fluid/operators/detail/grpc_service.h"
25-
#include "paddle/fluid/operators/detail/grpc_service.h"
2625
#include "paddle/fluid/operators/detail/send_recv.grpc.pb.h"
2726
#include "paddle/fluid/operators/detail/send_recv.pb.h"
27+
#include "paddle/fluid/operators/detail/sendrecvop_utils.h"
28+
#include "paddle/fluid/operators/detail/simple_block_queue.h"
2829

2930
namespace paddle {
3031
namespace operators {

paddle/fluid/operators/detail/test_serde.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ TEST(LodTensor, Run) {
199199
RunTestLodTensor(place);
200200
RunTestLodTensor(place, 1);
201201
#ifdef PADDLE_WITH_CUDA
202-
platform::CUDAPlace place;
203-
RunTestLodTensor(place);
204-
RunTestLodTensor(place, 1);
202+
platform::CUDAPlace gpu(0);
203+
RunTestLodTensor(gpu);
204+
RunTestLodTensor(gpu, 1);
205205
#endif
206206
}
207207

@@ -210,7 +210,7 @@ TEST(SelectedRows, Run) {
210210
RunSerdeTestSelectedRows(place);
211211

212212
#ifdef PADDLE_WITH_CUDA
213-
platform::CUDAPlace place;
214-
RunSerdeTestSelectedRows(place);
213+
platform::CUDAPlace gpu;
214+
RunSerdeTestSelectedRows(gpu);
215215
#endif
216216
}

paddle/fluid/operators/listen_and_serv_op.cc

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ class ListenAndServOp : public framework::OperatorBase {
9393
"server program should have at least 2 blocks");
9494

9595
framework::Executor executor(dev_place);
96-
std::vector<framework::ExecutorPrepareContext *> blk_ctx_list;
97-
blk_ctx_list.push_back(nullptr); // block0 is not used.
98-
for (int blkid = 1; blkid < num_blocks; ++blkid) {
99-
auto *exe_ctx = executor.Prepare(*program, blkid);
100-
blk_ctx_list.push_back(exe_ctx);
101-
}
10296

10397
// TODO(typhoonzero): change this to a while_op for every cluster-batch.
10498
bool exit_flag = false;
@@ -149,12 +143,11 @@ class ListenAndServOp : public framework::OperatorBase {
149143
std::vector<std::future<void>> fs;
150144
// block0 contains only listen_and_serv op, start run from block1.
151145
for (int blkid = 1; blkid < num_blocks - 1; ++blkid) {
152-
fs.push_back(framework::Async(
153-
[&executor, &program, &recv_scope, &blk_ctx_list, blkid]() {
146+
fs.push_back(
147+
framework::Async([&executor, &program, &recv_scope, blkid]() {
154148
int run_block = blkid; // thread local
155149
try {
156-
executor.RunPreparedContext(blk_ctx_list[run_block],
157-
&recv_scope, false, false);
150+
executor.Run(*program, &recv_scope, run_block, false, false);
158151
} catch (std::exception &e) {
159152
LOG(ERROR) << "run sub program error " << e.what();
160153
}
@@ -164,8 +157,7 @@ class ListenAndServOp : public framework::OperatorBase {
164157
// Run global block at final step, or block1 if there are only 2 blocks
165158
if (num_blocks >= 2) {
166159
try {
167-
executor.RunPreparedContext(blk_ctx_list[num_blocks - 1], &recv_scope,
168-
false, false);
160+
executor.Run(*program, &recv_scope, num_blocks - 1, false, false);
169161
} catch (std::exception &e) {
170162
LOG(ERROR) << "run sub program error " << e.what();
171163
}
@@ -185,9 +177,9 @@ class ListenAndServOp : public framework::OperatorBase {
185177
sparse_vars.clear();
186178
} // while(true)
187179

188-
for (int i = 0; i < num_blocks; ++i) {
189-
delete blk_ctx_list[i];
190-
}
180+
// for (int i = 0; i < num_blocks; ++i) {
181+
// delete blk_ctx_list[i];
182+
// }
191183
}
192184

193185
protected:

0 commit comments

Comments
 (0)