A question about "prim_minimum_spanning_tree.hpp"
Hi, I'm studying MST algorithms in GPU recently.I need BGL implementation as coparison,But I have a problem in using prim_minimum_spanning_tree.hpp.The problem is:when I use large input(e.g. >1M),there's a "segmnetation error" problem.But when the input(e.g. 1K) is small,the result is noproblem. I haven't found know the reason yet.My complier is gcc 4.1.2,OS is RHEL5. Help would be appreciated. Thanks in advance. Wang wei The complete code is in the attachment.
On 8/27/2010 4:52 AM, 王伟 wrote:
Hi, I'm studying MST algorithms in GPU recently.I need BGL implementation as coparison,But I have a problem in using prim_minimum_spanning_tree.hpp.The problem is:when I use large input(e.g. >1M),there's a "segmnetation error" problem.But when the input(e.g. 1K) is small,the result is noproblem. I haven't found know the reason yet.My complier is gcc 4.1.2,OS is RHEL5. Help would be appreciated. Thanks in advance. Wang wei The complete code is in the attachment.
There are a couple of things that would be helpful to try and report: 1) run your executable in gdb gdb ./BGLPrim run <arguments> backtrace quit and report the backtrace output. 2) run your code under valgrind valgrind --leak-check=summary ./BGLPrim <arguments> This will run slower, but will print out some information at the end of the execution that might also be very helpful. -Steve
Hi,
Sorry to reply so late,because I'm working on the CUDA implementation these
days.
I'm not very familiar to the gdb,so I need some time to learn it.At first I
doubt that my code's problem is at the definition of array,but after I
modified such as "E edges[num_edges]" to "E *edges = new E[num_edges]",the
result is always wrong even the input size is small.But I indeed don't
understand the difference between two froms.
Thank you very much!
Wang wei
2010/8/27 Stephen Woodbridge
On 8/27/2010 4:52 AM, 王伟 wrote:
Hi, I'm studying MST algorithms in GPU recently.I need BGL implementation as coparison,But I have a problem in using prim_minimum_spanning_tree.hpp.The problem is:when I use large input(e.g. >1M),there's a "segmnetation error" problem.But when the input(e.g. 1K) is small,the result is noproblem. I haven't found know the reason yet.My complier is gcc 4.1.2,OS is RHEL5. Help would be appreciated. Thanks in advance. Wang wei The complete code is in the attachment.
There are a couple of things that would be helpful to try and report:
1) run your executable in gdb
gdb ./BGLPrim run <arguments> backtrace quit
and report the backtrace output.
2) run your code under valgrind
valgrind --leak-check=summary ./BGLPrim <arguments>
This will run slower, but will print out some information at the end of the execution that might also be very helpful.
-Steve _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 8/27/2010 4:52 AM, 王伟 wrote:
Hi, I'm studying MST algorithms in GPU recently.I need BGL implementation as coparison,But I have a problem in using prim_minimum_spanning_tree.hpp.The problem is:when I use large input(e.g. >1M),there's a "segmnetation error" problem.But when the input(e.g. 1K) is small,the result is noproblem. I haven't found know the reason yet.My complier is gcc 4.1.2,OS is RHEL5. Help would be appreciated. Thanks in advance. Wang wei The complete code is in the attachment.
Can you post you test files somewhere that we can download them? Probably NOT a good idea to post then to the list if they are large. -Steve
Hi! You're allocating edges and weights on the stack: E edges[num_edges]; int weights[num_edges]; This is not a good idea, because stack space is very limited compared to the heap. Allocate these two vectors on the heap instead: E *edges = new E[num_edges]; int *weights = new int[num_edges]; .... delete[] edges; delete[] weights; Cheers, Gabe
participants (3)
-
Gábor Szuromi
-
Stephen Woodbridge
-
王伟