Software Archive
Read-only legacy content
17061 Discussions

Seg Fault with cilk -.-

Ryan_M_3
Beginner
2,334 Views

OK good news finally got my compiler up and linked properly xD. Bad news seg fault -.-. OK I'm using the cpp file of Fibonacci numbers provided by cilkplus.org . So when I go to add the extra arguement ex. ./a.out 2. I get a seg fault -.-. Any ideas. I DID NOT WRITE THE FILE lol.

cute_rj@Cute:~/cilk-fib$ which g++
/home/cute_rj/gcc-cilk/bin/g++
cute_rj@Cute:~/cilk-fib$ g++ -fcilkplus -lcilkrts fib.cpp
cute_rj@Cute:~/cilk-fib$ g++ -fcilkplus -lcilkrts fib.cpp
cute_rj@Cute:~/cilk-fib$ ./a.out 2
Segmentation fault (core dumped)
cute_rj@Cute:~/cilk-fib$

0 Kudos
15 Replies
Balaji_I_Intel
Employee
2,334 Views

Hi Ryan,

     I am not able to reproduce your issue. I tried the testcase and I got the following output:

/home/gcc> ../cilkplus-install/bin/g++ -fcilkplus fib.cpp -lcilkrts
/home/gcc> ./a.out
Fibonacci number #39 is 63245986.
Calculated in 0.890 seconds using 8 workers.
/home/gcc> ./a.out  2
Fibonacci number #39 is 63245986.
Calculated in 2.115 seconds using 2 workers.

Can you try to use gdb and see what is going on? (please recompile the source file with -g flag).

Thanks,

Balaji V. Iyer.

0 Kudos
Ryan_M_3
Beginner
2,334 Views

Funny thing is my professor has the same problem lol. I have no idea how to use gdb xD trying ddd

0 Kudos
Ryan_M_3
Beginner
2,334 Views

DDD didnt even want to help me. Gah

0 Kudos
Ryan_M_3
Beginner
2,334 Views

oh all we have is the compiler, no add ons or extensions and we built the complier

0 Kudos
Ryan_M_3
Beginner
2,334 Views

DDD doesn't seem to want to help me -.-

0 Kudos
Barry_T_Intel
Employee
2,334 Views

Rebuild the application using the following command:

   g++ -ggdb -fcilkplus -lcilkrts fib.cpp

This the -ggdb option will generate a binary with debug symbols for GDB.  Now execute the application under GDB:

   gdb ./a.out

When you get the GDB prompt, enter the command:

   run 2

This will run the application, and pass it 2 as it's parameter.  When GDB stops due to the error, issue the "bt" command to get a "backtrace". This should show you where in your application you are.  Post the results here.

    - Barry

0 Kudos
Ryan_M_3
Beginner
2,334 Views

This is what I got even though it don't make sense to me haha

cute_rj@Cute:~/cilk-fib$ g++ -ggdb -fcilkplus -lcilkrts fib.cpp
cute_rj@Cute:~/cilk-fib$ gdb ./a.out
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/cute_rj/cilk-fib/a.out...done.
(gdb) run 2
Starting program: /home/cute_rj/cilk-fib/a.out 2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb7caab40 (LWP 3986)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7caab40 (LWP 3986)]
0xb7fc63ba in cilk_fiber_sysdep::run() ()
at /home/cute_rj/gcc-cilk-src/libcilkrts/runtime/cilk_fiber-unix.cpp:170
170 do_post_switch_actions();
(gdb) bt
#0 0xb7fc63ba in cilk_fiber_sysdep::run() ()
at /home/cute_rj/gcc-cilk-src/libcilkrts/runtime/cilk_fiber-unix.cpp:170
#1 0xb7fc6483 in cilk_fiber_sysdep::resume_other_sysdep(cilk_fiber_sysdep*) [clone .isra.4] ()
at /home/cute_rj/gcc-cilk-src/libcilkrts/runtime/cilk_fiber-unix.cpp:111
#2 0xb7fc64cc in cilk_fiber_sysdep::suspend_self_and_resume_other_sysdep(cilk_fiber_sysdep*) ()
at /home/cute_rj/gcc-cilk-src/libcilkrts/runtime/cilk_fiber-unix.cpp:125
#3 0xb7fc5cee in cilk_fiber::suspend_self_and_resume_other(cilk_fiber*) ()
from /home/cute_rj/gcc-cilk/lib/libcilkrts.so.0
#4 0xb7fc5d43 in cilk_fiber_suspend_self_and_resume_other ()
from /home/cute_rj/gcc-cilk/lib/libcilkrts.so.0
#5 0xb7fcdda5 in worker_scheduler_function ()
at /home/cute_rj/gcc-cilk-src/libcilkrts/runtime/scheduler.c:2081
#6 0xb7fc9cea in __cilkrts_run_scheduler_with_exceptions ()
from /home/cute_rj/gcc-cilk/lib/libcilkrts.so.0
#7 0xb7fcff9f in scheduler_thread_proc_for_system_worker ()
from /home/cute_rj/gcc-cilk/lib/libcilkrts.so.0
#8 0xb7cb9d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#9 0xb7dbcdde in clone () from /lib/i386-linux-gnu/libc.so.6
(gdb)

0 Kudos
Ryan_M_3
Beginner
2,334 Views

ok waiting for approval for post -.-

0 Kudos
Ryan_M_3
Beginner
2,334 Views

Oh thanks for taking the time to help me!

0 Kudos
Balaji_I_Intel
Employee
2,334 Views

Are you using this compiler on a 64-bit machine? In your last thread you mentioned that you had LD_LIBRARY_PATH as the following:

echo $LD_LIBRARY_PATH
/home/cute_rj/gcc-cilk/lib

If you are using this on the 64-bit machine, then replace LD_LIBRARY_PATH with /home/cute_rj/gcc-cilk/lib64.

 

Thanks,

 

Balaji V. Iyer.

0 Kudos
Ryan_M_3
Beginner
2,334 Views

nope I'm using 32 bit virtual machine on a 64 bit computer 

0 Kudos
Balaji_I_Intel
Employee
2,334 Views

Yes, I am able to reproduce this issue.  I will get back to you when I get a solution.

Thanks,

Balaji V. Iyer.

0 Kudos
Ryan_M_3
Beginner
2,334 Views

Thanks! Hopefully this helps me down in the long run for my master's work

0 Kudos
Balaji_I_Intel
Employee
2,334 Views

Hi Ryan,

    We have found a fix for this issue. I am attaching a file called cilk-fiber_unix.cpp. Please save this file (and overwrite the existing one) in cilkplus-gcc/libcilkrts/runtime directory and then reconfigure and remake.

Please let me know if you still have issues.

Thanks,

Balaji V. Iyer.

0 Kudos
Ryan_M_3
Beginner
2,334 Views

Appreciate it! Will let you know!

0 Kudos
Reply