dmlc/MXNet.cpp

What's the problem that "Segmentation fault "

Closed this issue · 12 comments

When I run the example mlp, I get the message that "Segmentation fault".
And I debug with the gdb, the message is as follow

(gdb) r
Starting program: /home/wsy/MXNet.cpp/example/mlp 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff791b772 in std::__shared_ptr<mxnet::Symbol::Node, (__gnu_cxx::_Lock_policy)2>::operator-> (this=0x6c6562616c)
at /usr/include/c++/4.9/bits/shared_ptr_base.h:1048
1048 return _M_ptr;
(gdb) 

please try latest MXNET.cpp and mxnet to see if it solves your problem.
#24

@zhangchen-qinyinghua Can you tell me how to make the MXNET.cpp in detail? I read the readme but I'm not sure if I am right.

Seems to me your platform is Linux. So, it should be easy to compile mlp using the Makefile.
Compile mxnet, then

cp mxnet/lib/libmxnet.so MXNET.cpp/lib/linux
cd MXNET.cpp/example
make mlp
LD_LIBRARY_PATH=../lib/linux ./mlp

MXNET.cpp itself is a header-only library based on mxnet, which doesn't need compile.

@zhangchen-qinyinghua
Yes, I know that and what I did is like you said.
I have use the latest. But when I run the mlp, the line 53 will stop with a "Segmentation fault."

When I change the

auto sym_out = SoftmaxOutput("softmax", outputs[nLayers - 1], sym_label);

to

auto sym_out = LinearRegressionOutput("regression", outputs[nLayers - 1], sym_label);

there is no "Segmentation fault".
The new message is that:

[17:35:09] ../include/mxnet-cpp/executor.hpp:48: Check failed: (MXExecutorBind(symbol.GetHandle(), context.GetDeviceType(), context.GetDeviceId(), arg_handles.size(), arg_handles.data(), grad_handles.data(), grad_reqs_uint.data(), aux_handles.size(), aux_handles.data(), &handle_)) == (0) 

Still, it seems to me something wrong with the library.
Did you link the latest mxnet library?
Or did you modify the mlp.cpp?

BTW, the message given by LinearRegressionOutput may infer that the shape of your Label NDArray is wrong, which should be (128, 10). While if you were using SoftmaxOutput, the shape of the Label NDArray should be (128).

@zhangchen-qinyinghua Thank you for your answer!
I have use another computer and now I can run the example, but there are still some problems.
When the training is run to the last, it stops not normal with the message:

Segmentation fault (core dumped)

Are there some conditions for the computer?

The requirement of MXNET.cpp should be the same as mxnet, except that MXNET.cpp need your compiler supports c++11 features such as auto keyword and smart pointer.

Still I can't reproduce your problem. Have you modified any code of the mlp example?

hjk41 commented

inactive issue, closing for now

same problem.