Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Invoke operator fill_constant error

Open XY-Yolanda opened this issue 7 years ago • 4 comments

版本信息 paddle1.4.0 python2.7 CPU运行正常 GPU运行出错

EnforceNotMetTraceback (most recent call last)
<ipython-input-2-0bbe3f20249e> in <module>()
    207     # predict = 'multilayer_perceptron' # uncomment for MLP
    208     predict = 'convolutional_neural_network'  # uncomment for LeNet5
--> 209     main(use_cuda=use_cuda, nn_type=predict)

<ipython-input-2-0bbe3f20249e> in main(use_cuda, nn_type)
    194         save_dirname=save_dirname,
    195         model_filename=model_filename,
--> 196         params_filename=params_filename)
    197 #     infer(
    198 #         use_cuda=use_cuda,

<ipython-input-2-0bbe3f20249e> in train(nn_type, use_cuda, save_dirname, model_filename, params_filename)
    105     feeder = fluid.DataFeeder(feed_list=[img, label], place=place)
    106 
--> 107     exe.run(fluid.default_startup_program())
    108     # main_program = fluid.default_main_program()
    109     epochs = [epoch_id for epoch_id in range(PASS_NUM)]

/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/executor.pyc in run(self, program, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache)
    532                 scope=scope,
    533                 return_numpy=return_numpy,
--> 534                 use_program_cache=use_program_cache)
    535 
    536         program._compile(scope, self.place)

/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/executor.pyc in _run(self, program, exe, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache)
    604 
    605         self._feed_data(program, feed, feed_var_name, scope)
--> 606         exe.run(program.desc, scope, 0, True, True, fetch_var_name)
    607         outs = self._fetch_data(fetch_list, fetch_var_name, scope)
    608         if return_numpy:

EnforceNotMet: Invoke operator fill_constant error.
Python Callstacks: 
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1725, in _prepend_op
    attrs=kwargs.get("attrs", None))
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/initializer.py", line 167, in __call__
    stop_gradient=True)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1517, in create_var
    kwargs['initializer'](var, self)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/layer_helper_base.py", line 382, in set_variable_initializer
    initializer=initializer)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/layers/tensor.py", line 152, in create_global_var
    value=float(value), force_cpu=force_cpu))
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 136, in _create_global_learning_rate
    persistable=True)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 275, in _create_optimization_pass
    self._create_global_learning_rate()
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 441, in apply_gradients
    optimize_ops = self._create_optimization_pass(params_grads)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 469, in apply_optimize
    optimize_ops = self.apply_gradients(params_grads)
  File "/opt/conda/envs/py27-paddle/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 500, in minimize
    loss, startup_program=startup_program, params_grads=params_grads)
  File "<ipython-input-2-0bbe3f20249e>", line 79, in train
    optimizer.minimize(avg_loss)
  File "<ipython-input-2-0bbe3f20249e>", line 196, in main
    params_filename=params_filename)
  File "<ipython-input-2-0bbe3f20249e>", line 209, in <module>
    main(use_cuda=use_cuda, nn_type=predict)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2878, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2818, in run_ast_nodes
    if self.run_code(code, result):
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2714, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/zmqshell.py", line 537, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/ipkernel.py", line 208, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    handler(stream, idents, msg)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 438, in _run_callback
    callback(*args, **kwargs)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 486, in _handle_recv
    self._run_callback(callback, msg)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 456, in _handle_events
    self._handle_recv()
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 542, in <lambda>
    self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0))
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/tornado/ioloop.py", line 758, in _run_callback
    ret = callback()
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/tornado/ioloop.py", line 1017, in start
    self._run_callback(self._callbacks.popleft())
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 499, in start
    self.io_loop.start()
  File "/opt/conda/envs/python-2.7/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/local/cuda-9.2/conda/envs/python-2.7/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/opt/conda/envs/py27-paddle/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/conda/envs/py27-paddle/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
C++ Callstacks: 
Enforce failed. Expected allocating <= available, but received allocating:11177147796 > available:996212480.
Insufficient GPU memory to allocation. at [/paddle/paddle/fluid/platform/gpu_info.cc:262]
PaddlePaddle Call Stacks: 
0       0x7f70e8959338p void paddle::platform::EnforceNotMet::Init<std::string>(std::string, char const*, int) + 360
1       0x7f70e8959687p paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int) + 87
2       0x7f70ea69cb66p paddle::platform::GpuMaxChunkSize() + 630
3       0x7f70ea670ea2p
4       0x7f7162c35a99p
5       0x7f70ea67054dp paddle::memory::legacy::GetGPUBuddyAllocator(int) + 109
6       0x7f70ea671373p void* paddle::memory::legacy::Alloc<paddle::platform::CUDAPlace>(paddle::platform::CUDAPlace const&, unsigned long) + 35
7       0x7f70ea6717b5p paddle::memory::allocation::LegacyAllocator::AllocateImpl(unsigned long, paddle::memory::allocation::Allocator::Attr) + 389
8       0x7f70ea696a6bp paddle::memory::allocation::Allocator::Allocate(unsigned long, paddle::memory::allocation::Allocator::Attr) + 27
9       0x7f70ea6653b3p paddle::memory::allocation::AllocatorFacade::Alloc(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&, unsigned long, paddle::memory::allocation::Allocator::Attr) + 435
10      0x7f70ea6654d1p paddle::memory::allocation::AllocatorFacade::AllocShared(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&, unsigned long, paddle::memory::allocation::Allocator::Attr) + 33
11      0x7f70ea2a5bc0p paddle::memory::AllocShared(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&, unsigned long, paddle::memory::allocation::Allocator::Attr) + 48
12      0x7f70ea63776ap paddle::framework::Tensor::mutable_data(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>, paddle::framework::proto::VarType_Type, paddle::memory::allocation::Allocator::Attr, unsigned long) + 154
13      0x7f70e9613ed1p paddle::operators::FillConstantKernel<float>::Compute(paddle::framework::ExecutionContext const&) const + 497
14      0x7f70e9617073p std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::FillConstantKernel<float>, paddle::operators::FillConstantKernel<double>, paddle::operators::FillConstantKernel<long>, paddle::operators::FillConstantKernel<int>, paddle::operators::FillConstantKernel<paddle::platform::float16> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) + 35
15      0x7f70ea5e3176p paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&, paddle::framework::RuntimeContext*) const + 662
16      0x7f70ea5e38e4p paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) const + 292
17      0x7f70ea5e120cp paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) + 332
18      0x7f70e8acd0eep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 382
19      0x7f70e8acdf2fp paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, std::vector<std::string, std::allocator<std::string> > const&, bool) + 143
20      0x7f70e8948b5ep
21      0x7f70e898bf0ep
22      0x7f7162f6d1a7p PyEval_EvalFrameEx + 28695
23      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
24      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
25      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
26      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
27      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
28      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
29      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
30      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
31      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
32      0x7f7162f6f8eap PyEval_EvalCode + 26
33      0x7f7162f6bcc0p PyEval_EvalFrameEx + 23344
34      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
35      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
36      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
37      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
38      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
39      0x7f7162ef8567p
40      0x7f7162ed3973p PyObject_Call + 67
41      0x7f7162f6869ep PyEval_EvalFrameEx + 9486
42      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
43      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
44      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
45      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
46      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
47      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
48      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
49      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
50      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
51      0x7f7162ef8567p
52      0x7f7162ed3973p PyObject_Call + 67
53      0x7f7162f6869ep PyEval_EvalFrameEx + 9486
54      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
55      0x7f7162ef8567p
56      0x7f7162ed3973p PyObject_Call + 67
57      0x7f7162f6869ep PyEval_EvalFrameEx + 9486
58      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
59      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
60      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
61      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
62      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
63      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
64      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
65      0x7f7162ef8567p
66      0x7f7162ed3973p PyObject_Call + 67
67      0x7f7162f6869ep PyEval_EvalFrameEx + 9486
68      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
69      0x7f7162ef847ap
70      0x7f7162ed3973p PyObject_Call + 67
71      0x7f7161c65880p
72      0x7f7162ed3973p PyObject_Call + 67
73      0x7f7162f69d49p PyEval_EvalFrameEx + 15289
74      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
75      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
76      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
77      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
78      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
79      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
80      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
81      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
82      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
83      0x7f7162f6f8eap PyEval_EvalCode + 26
84      0x7f7162f6bcc0p PyEval_EvalFrameEx + 23344
85      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
86      0x7f7162f6cb98p PyEval_EvalFrameEx + 27144
87      0x7f7162f6f6c9p PyEval_EvalCodeEx + 2025
88      0x7f7162ef847ap
89      0x7f7162ed3973p PyObject_Call + 67
90      0x7f7162f9c320p
91      0x7f7162f9c9dep Py_Main + 1374
92      0x7f716216d830p __libc_start_main + 240
93      0x5555b59e707fp

XY-Yolanda avatar May 08 '19 08:05 XY-Yolanda

Enforce failed. Expected allocating <= available, but received allocating:11177147796 > available:996212480.
Insufficient GPU memory to allocation. at [/paddle/paddle/fluid/platform/gpu_info.cc:262]

这是爆显存了,参数过大或者显卡被占用导致的

kuke avatar May 08 '19 11:05 kuke

Enforce failed. Expected allocating <= available, but received allocating:11177147796 > available:996212480.
Insufficient GPU memory to allocation. at [/paddle/paddle/fluid/platform/gpu_info.cc:262]

这是爆显存了,参数过大或者显卡被占用导致的

可是把batchsize都已经调成1了 还是不报同样的问题 CPU可以正常运行 GPU一直报这个错

XY-Yolanda avatar May 09 '19 10:05 XY-Yolanda

Enforce failed. Expected allocating <= available, but received allocating:11177147796 > available:996212480.
Insufficient GPU memory to allocation. at [/paddle/paddle/fluid/platform/gpu_info.cc:262]

这是爆显存了,参数过大或者显卡被占用导致的

可是把batchsize都已经调成1了 还是不报同样的问题 CPU可以正常运行 GPU一直报这个错

是显存问题 解决了

XY-Yolanda avatar May 09 '19 10:05 XY-Yolanda

请问这个问题最后是怎么解决的了?

ChenPen1 avatar Aug 05 '19 11:08 ChenPen1