[thread_pool|range_ex|bind] Extrange behaviour with fibonacci example and parallel_sort
Hi, I have tried to do a parallel_sort using the Boost.ThreadPool library and I get some realy extrange. I have copied the fibonacci example and adapted it to do a parallel sort. See attached file. When I set the defines FIBO this works some times, don't finish others and crash the others. I have added some traces (define COUT) and I get better results but not always correct. I suspected that the threads in the thread pool needs to be stoped. I have added a pool shutdown but nothing changes. Oliver, could you take a look? When I define X_SORT the compilation even do not finish. What is wrong on my definition of parallel_sort? Am I using boost:bind incorrectly? Is there some issue with binding function templates? Can some one help me? Thanks in advance, Vicente P.S. I'm using Boost 1.37 + The file compiles only with the lates version of the Boost.Range library http://www.boostpro.com/vault/index.php?action=downloadfile&filename=range_ex.zip&directory=Algorithms&PHPSESSID=96307fee8086c06036af42fae790b449 and the Boost.ThreadPool version 17 http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost-threadpool.v17.tar.gz&directory=Concurrent%20Programming&PHPSESSID=96307fee8086c06036af42fae790b449 $ gcc --version gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Debug session $ gdb x_sort2 GNU gdb 6.8.0.20080328-cvs (cygwin-special) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help all" for the list of all commands. Type "help" followed by command name for full documentation. Type "apropos word" to search for commands related to "word". Command name abbreviations are allowed if unambiguous. (gdb) run Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 3056.0x128] [New thread 3056.0x68c] std::sort: reverse 0..100000 0.05 s [New thread 3056.0xfe4] [New thread 3056.0x1c8] 55 Program exited normally. (gdb) run Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 4028.0xd48] [New thread 4028.0xef4] std::sort: reverse 0..100000 0.03 s [New thread 4028.0x9ec] [New thread 4028.0x5bc] [New thread 4028.0x3bc] [Switching to thread 4028.0x3bc] Quit (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 2220.0x4dc] [New thread 2220.0xe58] std::sort: reverse 0..100000 0.05 s [New thread 2220.0x9b0] [New thread 2220.0x778] [New thread 2220.0x264] Program received signal SIGINT, Interrupt. [Switching to thread 2220.0x264] 0x7c87635d in KERNEL32!GetConsoleCharType (Quit (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 3964.0xf40] [New thread 3964.0xedc] std::sort: reverse 0..100000 0.05 s [New thread 3964.0x320] [New thread 3964.0xe44] [New thread 3964.0x544] [Switching to thread 3964.0x544] Quit (gdb) q The program is running. Exit anyway? (y or n) y Vicente@viboes1 ~/SVN/bin.v2/vbe_interthreads/libs/interthreads/test/x_sort2.tes t/gcc-3.4.4/debug/link-static/threading-multi $ gdb x_sort2 GNU gdb 6.8.0.20080328-cvs (cygwin-special) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) run Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 1076.0x31c] [New thread 1076.0x9b8] std::sort: reverse 0..100000 0.05 s [New thread 1076.0xaec] [New thread 1076.0xdc0] 19239 [unknown (0xDC0)] x_sort2 1076 _cygtls::handle_exceptions: Exception: ST ATUS_ACCESS_VIOLATION 59227 [unknown (0xDC0)] x_sort2 1076 open_stackdumpfile: Dumping stack trace t o x_sort2.exe.stackdump Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1076.0xdc0] 0x610b6132 in pthread_cond::~pthread_cond () from /usr/bin/cygwin1.dll (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 1876.0x8dc] [New thread 1876.0x938] std::sort: reverse 0..100000 0.05 s [New thread 1876.0x624] [New thread 1876.0xe28] 55 Program exited normally. (gdb) run Starting program: /home/Vicente/SVN/bin.v2/vbe_interthreads/libs/interthreads/te st/x_sort2.test/gcc-3.4.4/debug/link-static/threading-multi/x_sort2.exe [New thread 3240.0xef8] [New thread 3240.0xfb8] std::sort: reverse 0..100000 0.05 s [New thread 3240.0x5d4] [New thread 3240.0xe04] [New thread 3240.0x884] [Switching to thread 3240.0x884] Quit (gdb) q The program is running. Exit anyway? (y or n) y
participants (1)
-
vicente.botet