• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_PS_CORE_SERVER_NODE_H_
18 #define MINDSPORE_CCSRC_PS_CORE_SERVER_NODE_H_
19 
20 #include <cstdlib>
21 #include <iostream>
22 #include <memory>
23 #include <string>
24 #include <thread>
25 #include <utility>
26 #include <vector>
27 #include <unordered_map>
28 
29 #include "ps/core/cluster_metadata.h"
30 #include "ps/core/cluster_config.h"
31 #include "ps/ps_context.h"
32 #include "ps/core/communicator/tcp_client.h"
33 #include "ps/core/communicator/tcp_server.h"
34 #include "ps/core/abstract_node.h"
35 #include "ps/core/communicator/task_executor.h"
36 #include "ps/core/communicator/communicator_base.h"
37 
38 namespace mindspore {
39 namespace ps {
40 namespace core {
41 class ServerNode : public AbstractNode {
42  public:
43   ServerNode() = default;
44 
45   ~ServerNode() override = default;
46 
47   bool Start(const uint32_t &timeout = PSContext::instance()->cluster_config().cluster_available_timeout) override;
48   bool Stop() override;
49   bool Finish(const uint32_t &timeout = kTimeoutInSeconds) override;
50 
51  private:
52   void Initialize();
53 };
54 }  // namespace core
55 }  // namespace ps
56 }  // namespace mindspore
57 #endif  // MINDSPORE_CCSRC_PS_CORE_SERVER_NODE_H_
58