-------- Forwarded Message -------- From: Sergey Kuznetsov <latg...@gmail.com> To: Robbie Morrison <rob...@actrix.co.nz> Cc: GLPK help <help-glpk@gnu.org> Subject: Re: [Help-glpk] [Fwd: Problem with GLPK when trying to find value functions] Date: Thu, 26 Jul 2012 17:20:27 +0000
Hello again Robbie, Sorry, last time I didn't ran valgrind correctly. My binary called 'test' so it's probably ran /usr/bin/test But now I run my binary for sure and it works!!! I guess if I don't find bag in my code I will use valgrind. But I still want to find the bag just for self-learning. Again, thank you very much! Sergey On Thu, Jul 26, 2012 at 5:07 PM, Sergey Kuznetsov <latg...@gmail.com> wrote: Hello Robbie, I ran my binary under valgrind, here is summary: ==12805== HEAP SUMMARY: ==12805== in use at exit: 0 bytes in 0 blocks ==12805== total heap usage: 30 allocs, 30 frees, 1,971 bytes allocated ==12805== ==12805== All heap blocks were freed -- no leaks are possible ==12805== ==12805== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 6) --12805-- --12805-- used_suppression: 11 U1004-ARM-_dl_relocate_object ==12805== ==12805== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 6) and still the same problem as before running under valgrind: *** glibc detected *** ./test: free(): invalid pointer: 0x0828f350 *** ======= Backtrace: ========= /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x6e3f1)[0xb74773f1] /lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x6fc58)[0xb7478c58] /lib/i386-linux-gnu/i686/cmov/libc.so.6(cfree+0x6d)[0xb747bd0d] /usr/lib/libglpk.so.0(glp_free+0x141)[0xb76ed6b1] ======= Memory map: ======== .... >One other thought: GLPK is not officially thread safe: >do you call GLPK concurrently? At first, I ran GLPK in omp parallel for, it didn't enough memory for big instances, that's why I'm using in a loop: for each right-hand side{ call GLPK; store optimal value; } Thanks, Sergey On Thu, Jul 26, 2012 at 4:41 PM, Robbie Morrison <rob...@actrix.co.nz> wrote: Hello Sergey ------------------------------------------------------------ To: help-glpk@gnu.org Subject: Problem with GLPK when trying to find value functions From: Sergey Kuznetsov <latg...@gmail.com> Date: Wed, 25 Jul 2012 19:19:39 +0000 ------------------------------------------------------------ > Hello, > > I'm using GLPK to find value functions, it's a family > of linear programs with right-hand side as parameter. > > For instance, I'm constructing 3D integer lattice and > at each site (point) I need to find optimal solution > using site coordinates as right-hand side (in this case > it's 3D vector). > > I wrote a function that solves the linear program using > GLPK. At first it crashed on the second call. I > replaced glp_delete_prob() on gpl_erase_prob() and it > worked well for [0;3]^3 lattice (and [0;3]^2 > lattice). The problems began [0;4]^2 (2D) lattice. I > have segmentation fault and it's unusual because in > [0;3]^3 I'm solving more programs. > > OS : Linux Debian, i686; Compiler: GCC 4.7.1 > Test instances: 3D: 4 columns, 3 rows; 2D: 3 columns, 2 rows; all the > entries (matrix, objective function coeff, right-hand side) are > integers. > > Clearly, the problems begin when I'm setting span of > the lattice to 4 (5, 6, etc.). > > If anybody has any idea how to fix this, please help > me. Thanks > > Sergey Kuznetsov Run your program under 'valgrind': http://en.wikipedia.org/wiki/Valgrind http://valgrind.org It is dead easy to do so: $ valgrind [valgrind-options] myprog [my-options] 'valgrind' should pick up initialized variables and out of bounds array access. If not already on your system, 'valgrind' is available via debian package 'valgrind' (or my system). One other thought: GLPK is not officially thread safe: do you call GLPK concurrently? HTH, Robbie --- Robbie Morrison PhD student -- policy-oriented energy system simulation Technical University of Berlin (TU-Berlin), Germany University email (redirected) : morri...@iet.tu-berlin.de Webmail (preferred) : rob...@actrix.co.nz [from Webmail client] _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk