bayesopt:分段错误

时间:2016-04-15 13:29:01

标签: python c++ python-2.7 python-c-extension nlopt

我使用bayesopt和python绑定。 运行优化时,它在初始化步骤后失败。它计算第一个starting_points,然后运行nlopt。这是回溯:

Program received signal SIGSEGV, Segmentation fault. 0x00007fffcd75c024 in altmov_.isra.0 () from installs/bayesopt/lib/bayesopt.so Missing separate debuginfos, use: debuginfo-install glibc-2.17-78.el7.x86_64 libX11-1.6.0-2.1.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libpng-1.5.13-5.el7.x86_64 libxcb-1.9-5.el7.x86_64 qhull-2003.1-20.el7.x86_64 (gdb) traceback Undefined command: "traceback".  Try "help". (gdb) backtrace
#0  0x00007fffcd75c024 in altmov_.isra.0 () from installs/bayesopt/lib/bayesopt.so
#1  0x00007fffcd7606e1 in bobyqa () from installs/bayesopt/lib/bayesopt.so
#2  0x00007fffcd729ace in nlopt_optimize () from installs/bayesopt/lib/bayesopt.so
#3  0x00007fffcd676916 in bayesopt::run_nlopt(nlopt::algorithm, double (*)(unsigned int, double const*, double*, void*), boost::numeric::ublas::vector<double, boost::numeric::ublas::unbounded_array<double, std::allocator<double> &, int, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, void*) () from installs/bayesopt/lib/bayesopt.so
#4  0x00007fffcd678244 in bayesopt::NLOPT_Optimization::run(boost::numeric::ublas::vector<double, boost::numeric::ublas::unbounded_array<double, std::allocator<double> &) () from installs/bayesopt/lib/bayesopt.so
#5  0x00007fffcd64bf35 in bayesopt::ContinuousModel::findOptimal(boost::numeric::ublas::vector<double, boost::numeric::ublas::unbounded_array<double, std::allocator<double> &) () from installs/bayesopt/lib/bayesopt.so
#6  0x00007fffcd6566fc in bayesopt::BayesOptBase::nextPoint() () from installs/bayesopt/lib/bayesopt.so
#7  0x00007fffcd65a0e4 in bayesopt::BayesOptBase::stepOptimization() () from installs/bayesopt/lib/bayesopt.so
#8  0x00007fffcd65c6cc in bayesopt::BayesOptBase::optimize(boost::numeric::ublas::vector<double, boost::numeric::ublas::unbounded_array<double, std::allocator<double> &) () from installs/bayesopt/lib/bayesopt.so
#9  0x00007fffcd6bcf28 in bayes_optimization () from installs/bayesopt/lib/bayesopt.so
#10 0x00007fffcd722954 in __pyx_pf_8bayesopt_2optimize(_object*, _object*, int, tagPyArrayObject_fields*, tagPyArrayObject_fields*, _object*) [clone .isra.17] () from installs/bayesopt/lib/bayesopt.so
#11 0x00007fffcd723dfa in __pyx_pw_8bayesopt_3optimize(_object*, _object*, _object*) () from installs/bayesopt/lib/bayesopt.so

任何人都知道问题是什么?

我尝试查看代码以确定发生了什么,但我有点迷失。

编辑:

我用--leak-check=full and --track-origins=yes跑了valgrind,我看到了:

==57588== 159,457 bytes in 84 blocks are possibly lost in loss record 3,790 of 3,828
==57588==    at 0x4C29BBD: malloc (vg_replace_malloc.c:296)
==57588==    by 0x4ED4269: PyString_FromStringAndSize (stringobject.c:88)
==57588==    by 0x4F31E14: call_function (ceval.c:4350)
==57588==    by 0x4F31E14: PyEval_EvalFrameEx (ceval.c:2987)
==57588==    by 0x4F32A2D: PyEval_EvalCodeEx (ceval.c:3582)
==57588==    by 0x4F31A54: fast_function (ceval.c:4446)
==57588==    by 0x4F31A54: call_function (ceval.c:4371)
==57588==    by 0x4F31A54: PyEval_EvalFrameEx (ceval.c:2987)
==57588==    by 0x4F32A2D: PyEval_EvalCodeEx (ceval.c:3582)
==57588==    by 0x4F32B41: PyEval_EvalCode (ceval.c:669)
==57588==    by 0x4F44A81: PyImport_ExecCodeModuleEx (import.c:713)
==57588==    by 0x4F471CD: load_source_module (import.c:1103)
==57588==    by 0x4F47F80: import_submodule (import.c:2704)
==57588==    by 0x4F484BB: ensure_fromlist (import.c:2610)
==57588==    by 0x4F4895B: import_module_level (import.c:2273)
==57588==    by 0x4F4895B: PyImport_ImportModuleLevel (import.c:2292)
==57588== 
==57588== LEAK SUMMARY:
==57588==    definitely lost: 744 bytes in 3 blocks
==57588==    indirectly lost: 0 bytes in 0 blocks
==57588==      possibly lost: 389,836 bytes in 447 blocks
==57588==    still reachable: 31,047,162 bytes in 27,866 blocks
==57588==         suppressed: 0 bytes in 0 blocks
==57588== Reachable blocks (those to which a pointer was found) are not shown.
==57588== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==57588== 
==57588== For counts of detected and suppressed errors, rerun with: -v
==57588== ERROR SUMMARY: 38635 errors from 284 contexts (suppressed: 3 from 3)

0 个答案:

没有答案