Skip to content

Commit

Permalink
fix typo stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Liyulingyue committed Jan 31, 2025
1 parent 138c1cb commit 2bcbd04
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 45 deletions.
3 changes: 0 additions & 3 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ statment = 'statment'
staticly = 'staticly'
staticaly = 'staticaly'
Stati = 'Stati'
STOPED = 'STOPED'
Stoped = 'Stoped'
stoped = 'stoped'
storeage = 'storeage'
sotring = 'sotring'
stragety = 'stragety'
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/distributed/ps/service/brpc_ps_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ uint64_t BrpcPsServer::Start(const std::string &ip, uint32_t port) {
}

_environment->RegistePsServer(ip, port, _rank);
cv_.wait(lock, [&] { return stoped_; });
cv_.wait(lock, [&] { return stopped_; });

PSHost host;
host.ip = ip;
Expand Down Expand Up @@ -849,7 +849,7 @@ int32_t BrpcPsService::StopServer(Table *table,
auto *p_server = _server;
std::thread t_stop([p_server]() {
p_server->Stop();
VLOG(3) << "Server Stoped";
VLOG(3) << "Server Stopped";
});
t_stop.detach();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/distributed/ps/service/brpc_ps_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BrpcPsServer : public PSServer {
virtual uint64_t Start(const std::string &ip, uint32_t port);
virtual int32_t Stop() {
std::unique_lock<std::mutex> lock(mutex_);
stoped_ = true;
stopped_ = true;
cv_.notify_all();

_server.Stop(1000);
Expand All @@ -64,7 +64,7 @@ class BrpcPsServer : public PSServer {
virtual int32_t Initialize();
mutable std::mutex mutex_;
std::condition_variable cv_;
bool stoped_ = false;
bool stopped_ = false;
brpc::Server _server;
std::shared_ptr<PsBaseService> _service;
std::vector<std::shared_ptr<brpc::Channel>> _pserver_channels;
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/distributed/ps/service/graph_brpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ int32_t GraphBrpcService::StopServer(Table *table,
GraphBrpcServer *p_server = reinterpret_cast<GraphBrpcServer *>(_server);
std::thread t_stop([p_server]() {
p_server->Stop();
LOG(INFO) << "Server Stoped";
LOG(INFO) << "Server Stopped";
});
p_server->export_cv()->notify_all();
t_stop.detach();
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/distributed/ps/service/graph_brpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class GraphBrpcServer : public PSServer {
virtual brpc::Channel *GetCmdChannel(size_t server_index);
virtual int32_t Stop() {
std::unique_lock<std::mutex> lock(mutex_);
if (stoped_) return 0;
stoped_ = true;
if (stopped_) return 0;
stopped_ = true;
// cv_.notify_all();
_server.Stop(1000);
_server.Join();
Expand All @@ -51,7 +51,7 @@ class GraphBrpcServer : public PSServer {
virtual int32_t Initialize();
mutable std::mutex mutex_;
std::condition_variable cv_;
bool stoped_ = false;
bool stopped_ = false;
int rank;
brpc::Server _server;
std::shared_ptr<PsBaseService> _service;
Expand Down
16 changes: 8 additions & 8 deletions paddle/fluid/distributed/ps/service/heter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void HeterServer::StartHeterService(bool need_encrypt) {

{
std::lock_guard<std::mutex> lock(this->mutex_ready_);
stoped_ = false;
stopped_ = false;
ready_ = 1;
}
condition_ready_.notify_all();
VLOG(4) << "stopped: " << stoped_ << ", ready_: " << ready_;
VLOG(4) << "stopped: " << stopped_ << ", ready_: " << ready_;
std::unique_lock<std::mutex> running_lock(mutex_);
cv_.wait(running_lock, [&] {
VLOG(4) << "Heter Server is Stop? " << stoped_;
return stoped_;
VLOG(4) << "Heter Server is Stop? " << stopped_;
return stopped_;
});
VLOG(4) << "start service done";
}
Expand Down Expand Up @@ -85,15 +85,15 @@ void HeterServer::StartHeterInterService(bool need_encrypt) {
}
{
std::lock_guard<std::mutex> lock(this->mutex_ready_);
stoped_ = false;
stopped_ = false;
ready_ = 1;
}
condition_ready_.notify_all();
VLOG(4) << "stopped: " << stoped_ << ", ready_: " << ready_;
VLOG(4) << "stopped: " << stopped_ << ", ready_: " << ready_;
std::unique_lock<std::mutex> running_lock(mutex_);
cv_.wait(running_lock, [&] {
VLOG(4) << "Heter Server is Stop? " << stoped_;
return stoped_;
VLOG(4) << "Heter Server is Stop? " << stopped_;
return stopped_;
});
VLOG(4) << "start service done";
}
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/distributed/ps/service/heter_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,19 +582,19 @@ class HeterServer {
virtual ~HeterServer() {}
void Stop() {
std::unique_lock<std::mutex> lock(mutex_);
if (stoped_ == true) return;
if (stopped_ == true) return;
if (!IsExit()) {
service_.ForceExit();
}
stoped_ = true;
stopped_ = true;
cv_.notify_all();
server_.Stop(1000);
server_.Join();
}

bool IsStop() {
std::unique_lock<std::mutex> lock(mutex_);
return stoped_;
return stopped_;
}

bool IsExit() { return service_.IsExit(); }
Expand Down Expand Up @@ -664,7 +664,7 @@ class HeterServer {
static std::mutex mtx_;
std::condition_variable cv_;
std::condition_variable condition_ready_;
bool stoped_ = true;
bool stopped_ = true;
std::string endpoint_;
std::string endpoint_inter_;
// for switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ std::vector<FeatureNode> GraphPyClient::pull_graph_list(
void GraphPyClient::StopServer() {
VLOG(0) << "going to stop server";
std::unique_lock<std::mutex> lock(mutex_);
if (stoped_) return;
if (stopped_) return;
auto status = this->worker_ptr->StopServer();
if (status.get() == 0) stoped_ = true;
if (status.get() == 0) stopped_ = true;
}
void GraphPyClient::FinalizeWorker() { this->worker_ptr->FinalizeWorker(); }
} // namespace paddle::distributed
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class GraphPyClient : public GraphPyService {
int client_id;
std::shared_ptr<::paddle::distributed::GraphBrpcClient> worker_ptr;
std::thread* client_thread;
bool stoped_ = false;
bool stopped_ = false;
};
} // namespace distributed
} // namespace paddle
8 changes: 4 additions & 4 deletions paddle/fluid/platform/profiler/cuda_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CudaTracer::CudaTracer() = default;

void CudaTracer::PrepareTracing() {
PADDLE_ENFORCE_EQ(
state_ == TracerState::UNINITED || state_ == TracerState::STOPED,
state_ == TracerState::UNINITED || state_ == TracerState::STOPPED,
true,
common::errors::PreconditionNotMet("Tracer must be UNINITED"));
EnableCuptiActivity();
Expand All @@ -72,14 +72,14 @@ void CudaTracer::StopTracing() {
TracerState::STARTED,
common::errors::PreconditionNotMet("Tracer must be STARTED"));
DisableCuptiActivity();
state_ = TracerState::STOPED;
state_ = TracerState::STOPPED;
}

void CudaTracer::CollectTraceData(TraceEventCollector* collector) {
PADDLE_ENFORCE_EQ(
state_,
TracerState::STOPED,
common::errors::PreconditionNotMet("Tracer must be STOPED"));
TracerState::STOPPED,
common::errors::PreconditionNotMet("Tracer must be STOPPED"));
ProcessCuptiActivity(collector);
}

Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/platform/profiler/custom_device/custom_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void CustomTracer::Release() {

void CustomTracer::PrepareTracing() {
PADDLE_ENFORCE_EQ(
state_ == TracerState::UNINITED || state_ == TracerState::STOPED,
state_ == TracerState::UNINITED || state_ == TracerState::STOPPED,
true,
common::errors::PreconditionNotMet("CustomTracer must be UNINITED"));
#ifdef PADDLE_WITH_CUSTOM_DEVICE
Expand Down Expand Up @@ -88,14 +88,14 @@ void CustomTracer::StopTracing() {
#ifdef PADDLE_WITH_CUSTOM_DEVICE
phi::DeviceManager::ProfilerStopTracing(dev_type_, &collector_, context_);
#endif
state_ = TracerState::STOPED;
state_ = TracerState::STOPPED;
}

void CustomTracer::CollectTraceData(TraceEventCollector* collector) {
PADDLE_ENFORCE_EQ(
state_,
TracerState::STOPED,
common::errors::PreconditionNotMet("Tracer must be STOPED"));
TracerState::STOPPED,
common::errors::PreconditionNotMet("Tracer must be STOPPED"));
#ifdef PADDLE_WITH_CUSTOM_DEVICE
phi::DeviceManager::ProfilerCollectTraceData(
dev_type_, &collector_, tracing_start_ns_, context_);
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/platform/profiler/host_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void HostTracer::PrepareTracing() {

void HostTracer::StartTracing() {
PADDLE_ENFORCE_EQ(
state_ == TracerState::READY || state_ == TracerState::STOPED,
state_ == TracerState::READY || state_ == TracerState::STOPPED,
true,
common::errors::PreconditionNotMet("TracerState must be READY"));
HostEventRecorder<CommonEvent>::GetInstance().GatherEvents();
Expand All @@ -156,14 +156,14 @@ void HostTracer::StopTracing() {
TracerState::STARTED,
common::errors::PreconditionNotMet("TracerState must be STARTED"));
HostTraceLevel::GetInstance().SetLevel(HostTraceLevel::kDisabled);
state_ = TracerState::STOPED;
state_ = TracerState::STOPPED;
}

void HostTracer::CollectTraceData(TraceEventCollector* collector) {
PADDLE_ENFORCE_EQ(
state_,
TracerState::STOPED,
common::errors::PreconditionNotMet("TracerState must be STOPED"));
TracerState::STOPPED,
common::errors::PreconditionNotMet("TracerState must be STOPPED"));
HostEventSection<CommonEvent> host_events =
HostEventRecorder<CommonEvent>::GetInstance().GatherEvents();
ProcessHostEvents(host_events, collector);
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/platform/profiler/tracer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace platform {
class TracerBase {
public:
// The state machine for a Tracer.
enum class TracerState { UNINITED, READY, STARTED, STOPED };
enum class TracerState { UNINITED, READY, STARTED, STOPPED };

virtual void PrepareTracing() { state_ = TracerState::READY; }

Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/platform/profiler/xpu_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace paddle::platform {

void XPUTracer::PrepareTracing() {
PADDLE_ENFORCE_EQ(
state_ == TracerState::UNINITED || state_ == TracerState::STOPED,
state_ == TracerState::UNINITED || state_ == TracerState::STOPPED,
true,
common::errors::PreconditionNotMet("XPUTracer must be UNINITED"));
#ifdef PADDLE_WITH_XPTI
Expand Down Expand Up @@ -71,7 +71,7 @@ void XPUTracer::StopTracing() {
XPTI_CALL(phi::dynload::xptiActivityDisable());
VLOG(3) << "disable xpti activity";
#endif
state_ = TracerState::STOPED;
state_ = TracerState::STOPPED;
}

#ifdef PADDLE_WITH_XPTI
Expand Down Expand Up @@ -158,8 +158,8 @@ void AddMemcpyRecord(const baidu::xpu::xpti::XPTIEventMem* memcpy,
void XPUTracer::CollectTraceData(TraceEventCollector* collector) {
PADDLE_ENFORCE_EQ(
state_,
TracerState::STOPED,
common::errors::PreconditionNotMet("Tracer must be STOPED"));
TracerState::STOPPED,
common::errors::PreconditionNotMet("Tracer must be STOPPED"));
#ifdef PADDLE_WITH_XPTI
XPTI_CALL(phi::dynload::xptiActivityFlushAll());
baidu::xpu::xpti::XPTIEvent* record = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/api/profiler/tracer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace phi {
class TracerBase {
public:
// The state machine for a Tracer.
enum class TracerState { UNINITED, READY, STARTED, STOPED };
enum class TracerState { UNINITED, READY, STARTED, STOPPED };

virtual void PrepareTracing() { state_ = TracerState::READY; }

Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/auto_parallel/static/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ def is_by_json_config(json_config):
retry = False
logger.info("server stopped success")
else:
logger.info("server stoped failed! retry later")
logger.info("server stopped failed! retry later")
time.sleep(1)
logger.info(
f'cluster_topo_info: {json.dumps(cluster.mesh_group.to_json(), indent=3)}'
Expand Down

0 comments on commit 2bcbd04

Please sign in to comment.