[mlpack-git] [mlpack] Segmentation fault with armadillo v5 and up (#431)

John Lees notifications at github.com
Wed Apr 15 05:47:01 EDT 2015


Ok, here's some more information about what I've done.
Firstly I have removed any currently existing versions of armadillo or mlpack anywhere on the system (which is Ubuntu 12.04)

I install arma 5.000.0 with

    cmake -DCMAKE_CXX_COMPILER_ID=Intel -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CXX_FLAGS=-O3 .
    make
    make install DESTDIR=~/software

I used your update to CMakeLists.txt as referenced above, then installed mlpack with

    cmake -DCMAKE_INSTALL_PREFIX:PATH=~/software -DBOOST_ROOT=~/software ../
    make
    make install

which didn't warn about 64 bit words not being used

I then compile my application with

    g++ -Wall -g -O0 -std=c++11 -I${HOME}/software/include -I/usr/include/libxml2 -c -o app.o app.cpp

and link with

    g++ -Wall -g -O0 -std=c++11 -I${HOME}/software/include -I/usr/include/libxml2 app.o -L${HOME}/software/lib -lmlpack -larmadillo -lboost_program_options -lblas -llapack -lm -o app

however I still get a conflict due to word length

    error: arma::memory::acquire(): out of memory

    terminate called after throwing an instance of 'std::bad_alloc'
    what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    0x00007ffff57300d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
    
    (gdb) bt
    #0  0x00007ffff57300d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
    #1  0x00007ffff573383b in abort () from /lib/x86_64-linux-gnu/libc.so.6
    #2  0x00007ffff602b2d5 in __gnu_cxx::__verbose_terminate_handler () at ../../.././libstdc++-v3/libsupc++/vterminate.cc:95
    #3  0x00007ffff6029336 in __cxxabiv1::__terminate (handler=<optimised out>) at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:47
    #4  0x00007ffff6029381 in std::terminate () at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:57
    #5  0x00007ffff6029598 in __cxxabiv1::__cxa_throw (obj=0x7fffec000940, tinfo=0x6bf600 <typeinfo for std::bad_alloc@@GLIBCXX_3.4>,
    dest=0x416260 <std::bad_alloc::~bad_alloc()@plt>) at ../../.././libstdc++-v3/libsupc++/eh_throw.cc:87
    #6  0x0000000000418ca4 in arma::arma_stop_bad_alloc<char [39]> (x=...) at ~/software/include/armadillo_bits/debug.hpp:138
    #7  0x000000000041a829 in arma::arma_check_bad_alloc<char [39]> (state=true, x=...) at ~/software/include/armadillo_bits/debug.hpp:378
    #8  0x000000000041a63d in arma::memory::acquire<double> (n_elem=8589934596) at ~/software/include/armadillo_bits/memory.hpp:94
    #9  0x000000000041a525 in arma::Mat<double>::init_warm (this=0x7fffffffab20, in_n_rows=4294967298, in_n_cols=2)
    at ~/software/include/armadillo_bits/Mat_meat.hpp:311
    #10 0x000000000042d4bf in arma::Mat<double>::set_size (this=0x7fffffffab20, in_rows=4294967298, in_cols=2)
    at ~/software/include/armadillo_bits/Mat_meat.hpp:5638
    #11 0x000000000047503d in mlpack::optimization::L_BFGS<mlpack::regression::LogisticRegressionFunction>::L_BFGS (this=0x7fffffffab10, function=...,
    numBasis=5, maxIterations=0, armijoConstant=0.0001, wolfe=0.90000000000000002, minGradientNorm=1e-10, maxLineSearchTrials=50,
    minStep=9.9999999999999995e-21, maxStep=1e+20) at ~/software/include/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp:63
    #12 0x00000000004744a2 in mlpack::regression::LogisticRegression<mlpack::optimization::L_BFGS>::LogisticRegression (this=0x7fffffffb330, predictors=...,
    responses=..., lambda=0) at ~/software/include/mlpack/methods/logistic_regression/logistic_regression_impl.hpp:33

This happens regardless of whether I have #define ARMA_64BIT_WORD in armadillo_bits/config.hpp commented or uncommented

I should note the identical process worked fine with armadillo.4.650

Inspecting the libraries

    ldd app

    libmlpack.so.1 => ~/software/lib/libmlpack.so.1 (0x00007f3ff4a18000)
    libarmadillo.so.5 => ~/software/lib/libarmadillo.so.5 (0x00007f3ff4813000)
    libboost_program_options.so.1.57.0 => ~/software/lib/libboost_program_options.so.1.57.0 (0x00007f3ff45a3000)
    libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007f3ff403a000)
    liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007f3ff341d000)
    libstdc++.so.6 => /software/gcc-4.9.1/lib64/libstdc++.so.6 (0x00007f3ff3112000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3ff2e16000)
    libgcc_s.so.1 => /software/gcc-4.9.1/lib64/libgcc_s.so.1 (0x00007f3ff2c00000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ff2840000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3ff2623000)
    libboost_unit_test_framework.so.1.57.0 => ~/software/lib/libboost_unit_test_framework.so.1.57.0 (0x00007f3ff237c000)
    libboost_random.so.1.57.0 => ~/software/lib/libboost_random.so.1.57.0 (0x00007f3ff2176000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f3ff1e1a000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3ff1c12000)
    libmkl_rt.so => /software/intel-tools-2015/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_rt.so (0x00007f3ff169b000)
    libimf.so => /software/intel-tools-2015/composer_xe_2015.0.090/compiler/lib/intel64/libimf.so (0x00007f3ff11e1000)
    libsvml.so => /software/intel-tools-2015/composer_xe_2015.0.090/compiler/lib/intel64/libsvml.so (0x00007f3ff0592000)
    libirng.so => /software/intel-tools-2015/composer_xe_2015.0.090/compiler/lib/intel64/libirng.so (0x00007f3ff038a000)
    libintlc.so.5 => /software/intel-tools-2015/composer_xe_2015.0.090/compiler/lib/intel64/libintlc.so.5 (0x00007f3ff0130000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3feff2c000)
    libgfortran.so.3 => /software/gcc-4.9.1/lib64/libgfortran.so.3 (0x00007f3fefc0f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3ff4f40000)
    libboost_system.so.1.57.0 => ~/software/lib/libboost_system.so.1.57.0 (0x00007f3fefa0c000)
    libquadmath.so.0 => /software/gcc-4.9.1/lib/../lib64/libquadmath.so.0 (0x00007f3fef7ce000)

My above ld error I think was caused by compiling mlpack against a different boost from the one that was then loaded (which I've now fixed)

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/431#issuecomment-93289657
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20150415/24840d07/attachment-0001.html>


More information about the mlpack-git mailing list