未验证 提交 0d17c1b8 编写于 作者: T Thunderbrook 提交者: GitHub

solve pslib core in stop worker (#21263)

* general table

* add sparse table
test=develop

* no cvm
test=develop

* add no_cvm
test=develop

* add note
test=develop

* code style
test=develop

* code style
test=develop

* code style
test=develop

* code style
test=develop

* code style
test=develop

* add key of optimizer
test=develop

* solve pslib stop core
test=develop

* barrier
test=develop

* add notes
test=develop
上级 fa4d0550
...@@ -91,6 +91,13 @@ void FleetWrapper::StopServer() { ...@@ -91,6 +91,13 @@ void FleetWrapper::StopServer() {
#endif #endif
} }
void FleetWrapper::FinalizeWorker() {
#ifdef PADDLE_WITH_PSLIB
VLOG(3) << "Going to finalize worker";
pslib_ptr_->finalize_worker();
#endif
}
uint64_t FleetWrapper::RunServer() { uint64_t FleetWrapper::RunServer() {
#ifdef PADDLE_WITH_PSLIB #ifdef PADDLE_WITH_PSLIB
VLOG(3) << "Going to run server"; VLOG(3) << "Going to run server";
......
...@@ -147,6 +147,8 @@ class FleetWrapper { ...@@ -147,6 +147,8 @@ class FleetWrapper {
int index); int index);
// stop server // stop server
void StopServer(); void StopServer();
// finalize worker to make worker can be stop
void FinalizeWorker();
// run server // run server
uint64_t RunServer(); uint64_t RunServer();
// gather server ip // gather server ip
......
...@@ -55,6 +55,7 @@ void BindFleetWrapper(py::module* m) { ...@@ -55,6 +55,7 @@ void BindFleetWrapper(py::module* m) {
.def("load_model", &framework::FleetWrapper::LoadModel) .def("load_model", &framework::FleetWrapper::LoadModel)
.def("clear_model", &framework::FleetWrapper::ClearModel) .def("clear_model", &framework::FleetWrapper::ClearModel)
.def("stop_server", &framework::FleetWrapper::StopServer) .def("stop_server", &framework::FleetWrapper::StopServer)
.def("finalize_worker", &framework::FleetWrapper::FinalizeWorker)
.def("gather_servers", &framework::FleetWrapper::GatherServers) .def("gather_servers", &framework::FleetWrapper::GatherServers)
.def("gather_clients", &framework::FleetWrapper::GatherClients) .def("gather_clients", &framework::FleetWrapper::GatherClients)
.def("get_clients_info", &framework::FleetWrapper::GetClientsInfo) .def("get_clients_info", &framework::FleetWrapper::GetClientsInfo)
......
...@@ -182,6 +182,10 @@ class PSLib(Fleet): ...@@ -182,6 +182,10 @@ class PSLib(Fleet):
destroyed when stop() is called. destroyed when stop() is called.
""" """
self._role_maker._barrier_worker() self._role_maker._barrier_worker()
# all worker should be finalize first
if self._role_maker.is_worker():
self._fleet_ptr.finalize_worker()
self._role_maker._barrier_worker()
if self._role_maker.is_first_worker(): if self._role_maker.is_first_worker():
self._fleet_ptr.stop_server() self._fleet_ptr.stop_server()
self._role_maker._barrier_worker() self._role_maker._barrier_worker()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册