Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

PaddlePaddle == 2.0.0rc分布式训练,报Communicator is not Initialized, you may use FleetAPI

Open Saga145AI opened this issue 5 years ago • 5 comments

PaddlePaddle版本:2.0.0rc CPU版本 CPU型号,虚拟机中虚拟的CPU 操作系统Centos7.2 环境描述 虚拟机搭建了一个参数服务器集群, 参数服务进程运行在172.16.128.21:36011端,并且参数服务进程启动正常, 工作服务进程运行在172.16.128.20服务器, 工作服务进程启动失败 完整报错信息如下: [root@localhost paddle_fleet_workspace2]# python m_fleet_dy_ws_0.py /pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/distributed/fleet/base/fleet_base.py:617: UserWarning: It is recommended to use DistributedStrategy in fleet.init(). The strategy here is only for compatibility. If the strategy in fleet.distributed_optimizer() is not None, then it will overwrite the DistributedStrategy in fleet.init(), which will take effect in distributed training. "It is recommended to use DistributedStrategy " W0129 03:06:42.391901 3788 build_strategy.cc:171] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. W0129 03:06:42.392207 3788 build_strategy.cc:396] fuse_bn_add_act_pass is only supported on GPU, skipped. W0129 03:06:42.394238 3788 build_strategy.cc:171] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. W0129 03:06:42.394574 3788 build_strategy.cc:396] fuse_bn_add_act_pass is only supported on GPU, skipped. Traceback (most recent call last): File "m_fleet_dy_ws_0.py", line 63, in fetch_list=[cost.name]) File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/fluid/executor.py", line 1108, in run six.reraise(*sys.exc_info()) File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/six.py", line 693, in reraise raise value File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/fluid/executor.py", line 1106, in run return_merged=return_merged) File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/fluid/executor.py", line 1215, in _run_impl program._graph._compile(scope, self.place) File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/fluid/compiler.py", line 454, in _compile places=self._places) File "/pmodata/tenw/tools/python35/lib/python3.5/site-packages/paddle/fluid/compiler.py", line 407, in _compile_data_parallel self._exec_strategy, self._build_strategy, self._graph) ValueError: (InvalidArgument) Communicator is not Initialized, you may use FleetAPI(https://github.com/PaddlePaddle/Fleet/tree/develop/markdown_doc/transpiler) [Hint: Expected initialized == true, but received initialized:0 != true:1.] (at /paddle/paddle/fluid/framework/details/async_ssa_graph_executor.cc:75) [Hint: If you need C++ stacktraces for debugging, please set FLAGS_call_stack_level=2.]

参数服务器代完整码如下 import paddle import paddle.fluid as fluid import numpy as np paddle.enable_static()

import paddle.distributed.fleet.base.role_maker as role_maker import paddle.distributed.fleet as fleet

def mlp2(input_x, input_y, hid_dim=128, label_dim=2): fc_1 = paddle.static.nn.fc(input=input_x, size=hid_dim, act='tanh') fc_2 = paddle.static.nn.fc(input=fc_1, size=hid_dim, act='tanh') prediction = paddle.static.nn.fc(input=[fc_2], size=label_dim, act='softmax') cost = paddle.static.nn.cross_entropy(input=prediction, label=input_y) avg_cost = paddle.static.nn.mean(x=cost) return avg_cost

def mlp(input_x, input_y, hid_dim=1280, label_dim=2): fc_1 = fluid.layers.fc(input=input_x, size=hid_dim, act='tanh') fc_2 = fluid.layers.fc(input=fc_1, size=hid_dim, act='tanh') prediction = fluid.layers.fc(input=[fc_2], size=label_dim, act='softmax') cost = fluid.layers.cross_entropy(input=prediction, label=input_y) avg_cost = fluid.layers.mean(x=cost) return avg_cost

def gen_data(): return {"x": np.random.random(size=(128, 32)).astype('float32'), "y": np.random.randint(2, size=(128, 1)).astype('int64')}

input_x = paddle.static.data(name="x", shape=[None, 32], dtype='float32') input_y = paddle.static.data(name="y", shape=[None, 1], dtype='int64')

cost = mlp(input_x, input_y) optimizer = paddle.optimizer.SGD(learning_rate=0.01)

role = role_maker.UserDefinedRoleMaker( current_id=0, role=role_maker.Role.SERVER, worker_num=1, server_endpoints=["172.16.128.21:36011"]) fleet.init(role)

strategy = paddle.distributed.fleet.DistributedStrategy() strategy.a_sync = False

optimizer = fleet.distributed_optimizer(optimizer, strategy) optimizer.minimize(cost)

if fleet.is_server(): fleet.init_server() fleet.run_server()

elif fleet.is_worker(): place = paddle.CPUPlace() exe = paddle.static.Executor(place) exe.run(paddle.static.default_startup_program())

step = 1001 for i in range(step): cost_val = exe.run( program=paddle.static.default_main_program(), feed=gen_data(), fetch_list=[cost.name]) print("worker_index: %d, step%d cost = %f" % (fleet.worker_index(), i, cost_val[0]))

工作服务器代完整码如下 import paddle import paddle.fluid as fluid import numpy as np paddle.enable_static()

import paddle.distributed.fleet.base.role_maker as role_maker import paddle.distributed.fleet as fleet

def mlp2(input_x, input_y, hid_dim=128, label_dim=2): fc_1 = paddle.static.nn.fc(input=input_x, size=hid_dim, act='tanh') fc_2 = paddle.static.nn.fc(input=fc_1, size=hid_dim, act='tanh') prediction = paddle.static.nn.fc(input=[fc_2], size=label_dim, act='softmax') cost = paddle.static.nn.cross_entropy(input=prediction, label=input_y) avg_cost = paddle.static.nn.mean(x=cost) return avg_cost

def mlp(input_x, input_y, hid_dim=1280, label_dim=2): fc_1 = fluid.layers.fc(input=input_x, size=hid_dim, act='tanh') fc_2 = fluid.layers.fc(input=fc_1, size=hid_dim, act='tanh') prediction = fluid.layers.fc(input=[fc_2], size=label_dim, act='softmax') cost = fluid.layers.cross_entropy(input=prediction, label=input_y) avg_cost = fluid.layers.mean(x=cost) return avg_cost

def gen_data(): return {"x": np.random.random(size=(128, 32)).astype('float32'), "y": np.random.randint(2, size=(128, 1)).astype('int64')}

input_x = paddle.static.data(name="x", shape=[None, 32], dtype='float32') input_y = paddle.static.data(name="y", shape=[None, 1], dtype='int64')

cost = mlp(input_x, input_y) optimizer = paddle.optimizer.SGD(learning_rate=0.01)

role = role_maker.UserDefinedRoleMaker( current_id=0, role=role_maker.Role.WORKER, worker_num=1, server_endpoints=["172.16.128.21:36011"]) fleet.init(role)

strategy = paddle.distributed.fleet.DistributedStrategy() strategy.a_sync = False

optimizer = fleet.distributed_optimizer(optimizer, strategy) optimizer.minimize(cost)

if fleet.is_server(): fleet.init_server() fleet.run_server()

elif fleet.is_worker(): place = paddle.CPUPlace() exe = paddle.static.Executor(place) exe.run(paddle.static.default_startup_program())

step = 1001 for i in range(step): cost_val = exe.run( program=paddle.static.default_main_program(), feed=gen_data(), fetch_list=[cost.name]) print("worker_index: %d, step%d cost = %f" % (fleet.worker_index(), i, cost_val[0]))

Saga145AI avatar Jan 29 '21 11:01 Saga145AI

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day!

paddle-bot-old avatar Jan 29 '21 11:01 paddle-bot-old

【有奖问卷调查】感谢大家对飞桨的支持,现在飞桨技术团队想了解一下高校实验室的硬件使用情况,邀请您抽出10-15min 的时间来完成一个问卷调研,我们会认真考虑每个人的实验场景和大家反馈的问题,以便在飞桨框架对GPU等硬件资源的支持上作出进一步优化,完成问卷后我们会送出一份精美礼品作为感谢~ 问卷链接:https://paddle.wjx.cn/vj/YmeuTy1.aspx

paddle-bot-old avatar Jan 29 '21 11:01 paddle-bot-old

你好,感谢反馈,目前已经在安排开发人员跟进此问题

haozech avatar Feb 01 '21 09:02 haozech

你好,感谢反馈,目前已经在安排开发人员跟进此问题

我现在下载了paddlepaddle 2.0.0的docker镜像,结果也是报这个问题

pwd

/docker_root

ls -lrt

total 594056 -rw-r--r--. 1 root root 2244 Feb 3 09:57 m_fleet_dy_ps_1.py -rw-r--r--. 1 root root 2244 Feb 3 09:57 m_fleet_dy_02.py -rw-r--r--. 1 root root 1442 Feb 3 09:58 m_fleet_dy_01.py -rw-r--r--. 1 root root 2244 Feb 3 09:58 m_fleet_dy_ws_1.py -rw-r--r--. 1 root root 2244 Feb 3 09:58 m_fleet_dy_ps_0.py -rw-r--r--. 1 root root 163867 Feb 3 09:59 fc_0.w_0 -rw-r--r--. 1 root root 6553628 Feb 3 09:59 fc_1.w_0 -rw-r--r--. 1 root root 5145 Feb 3 09:59 fc_0.b_0 -rw-r--r--. 1 root root 5145 Feb 3 09:59 fc_1.b_0 -rw-r--r--. 1 root root 28 Feb 3 09:59 learning_rate_0 -rw-r--r--. 1 root root 10267 Feb 3 09:59 fc_2.w_0 -rw-r--r--. 1 root root 32 Feb 3 09:59 fc_2.b_0 -rw-r--r--. 1 root root 2244 Feb 3 10:04 m_fleet_dy_ws_0.py -rw-------. 1 root root 324902912 Feb 3 10:04 core.17776 -rw-------. 1 root root 327344128 Feb 3 10:05 core.17793

python3

Python 3.5.1 (default, Jan 28 2021, 04:45:23) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

exit()

python3 m_fleet_dy_ws_0.py

/usr/local/python3.5.1/lib/python3.5/site-packages/paddle/distributed/fleet/base/fleet_base.py:627: UserWarning: It is recommended to use DistributedStrategy in fleet.init(). The strategy here is only for compatibility. If the strategy in fleet.distributed_optimizer() is not None, then it will overwrite the DistributedStrategy in fleet.init(), which will take effect in distributed training. "It is recommended to use DistributedStrategy " W0203 10:10:18.904122 177 build_strategy.cc:171] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. W0203 10:10:18.904204 177 build_strategy.cc:430] fuse_bn_add_act_pass is only supported on GPU, skipped. W0203 10:10:18.905539 177 build_strategy.cc:171] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. W0203 10:10:18.905573 177 build_strategy.cc:430] fuse_bn_add_act_pass is only supported on GPU, skipped.


C++ Traceback (most recent call last):

0 paddle::framework::ParallelExecutor::Run(std::vector<std::string, std::allocator<std::string > > const&, bool) 1 paddle::framework::details::AsyncSSAGraphExecutor::Run(std::vector<std::string, std::allocator<std::string > > const&, bool) 2 paddle::framework::details::ThreadedSSAGraphExecutor::Run(std::vector<std::string, std::allocator<std::string > > const&, bool) 3 paddle::framework::details::ThreadedSSAGraphExecutor::RunImpl(std::vector<std::string, std::allocator<std::string > > const&, bool) 4 paddle::framework::details::ThreadedSSAGraphExecutor::RunOp(std::shared_ptr<paddle::framework::BlockingQueuepaddle::framework::details::VarHandleBase* > const&, paddle::framework::details::OpHandleBase*) 5 paddle::framework::details::ThreadedSSAGraphExecutor::RunOpSync(paddle::framework::details::OpHandleBase*) 6 paddle::framework::details::OpHandleBase::Run(paddle::platform::DeviceType) 7 paddle::framework::details::ComputationOpHandle::RunImpl() 8 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 9 paddle::operators::SendOp::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 10 paddle::framework::SignalHandle(char const*, int) 11 paddle::platform::GetCurrentTraceBackStringabi:cxx11


Error Message Summary:

FatalError: Segmentation fault is detected by the operating system. [TimeInfo: *** Aborted at 1612347019 (unix time) try "date -d @1612347019" if you are using GNU date ***] [SignalInfo: *** SIGSEGV (@0x0) received by PID 177 (TID 0x7f3615b60700) from PID 0 ***]

Segmentation fault (core dumped)

Saga145AI avatar Feb 03 '21 10:02 Saga145AI

你好,感谢反馈,目前已经在安排开发人员跟进此问题

而且我的CPU支持avx指令集 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 158 model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz stepping : 9 microcode : 0x8e cpu MHz : 2808.007 cache size : 6144 KB physical id : 2 siblings : 1 core id : 0 cpu cores : 1 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch arat fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xsaves bogomips : 5616.01 clflush size : 64 cache_alignment : 64 address sizes : 43 bits physical, 48 bits virtual

Saga145AI avatar Feb 03 '21 10:02 Saga145AI