提交 5ae0c664 编写于 作者: Y yi.wu

fix build and merge develop

上级 6387a15b
......@@ -24,6 +24,7 @@ limitations under the License. */
#include "paddle/fluid/operators/listen_and_serv_op.h"
#include "paddle/fluid/operators/math/math_function.h"
#include "paddle/fluid/operators/math/selected_rows_functor.h"
#include "paddle/fluid/platform/nccl_helper.h"
#include "paddle/fluid/string/printf.h"
USE_NO_KERNEL_OP(listen_and_serv);
......@@ -36,7 +37,7 @@ namespace string = paddle::string;
std::unique_ptr<detail::AsyncGRPCServer> rpc_service;
void StartServer() {
void StartServer(std::atomic<bool>* initialized) {
f::Scope scope;
p::CPUPlace place;
scope.Var(NCCL_ID_VARNAME);
......@@ -54,6 +55,7 @@ void StartServer() {
std::thread server_thread(
std::bind(&detail::AsyncGRPCServer::RunSyncUpdate, rpc_service.get()));
*initialized = true;
rpc_service->SetCond(0);
auto recv = rpc_service->Get();
LOG(INFO) << "got nccl id and stop server...";
......@@ -62,9 +64,13 @@ void StartServer() {
}
TEST(SendNcclId, Normal) {
std::thread server_thread(StartServer);
std::atomic<bool> initialized{false};
std::thread server_thread(StartServer, &initialized);
while (!initialized) {
}
// wait server to start
rpc_service.WaitServerReady();
// sleep(2);
rpc_service->WaitServerReady();
f::Scope scope;
p::CPUPlace place;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册