Author Topic: Intel Cilk Plus  (Read 9497 times)

ashiq_rahman

  • Guest
Intel Cilk Plus
« on: June 05, 2015, 04:37:37 pm »
hello,

I have problem ... plz help me out.

I am using Ubuntu 14.04 LTS and using Codeblocks for C/C++, GCC 4.9.2
Now I install "Intel Cilk Plus" using "Synaptic Package manager"
 => libcilkrts5
 => libcilkrts-dbg
 => libx32cilkrts5
 => libx32cilkrts5-dbg
it installs cilk runtime files in "usr/bin" and headers in "/usr/lib/gcc/i686-linux-gnu/4.9.2".
Now problem is ... how i execute code written in "Intel Cilk Plus" using "codeblocks"

sample code:
/**********************************/
#include <stdio.h>
#include <stdlib.h>
#include <cilk/cilk.h>

int sum = 0;

void f(int arg)
{
    sum += arg;
}

int main()
{
    cilk_spawn f(1);
    cilk_spawn f(2);

    cilk_sync;
    printf("Sum is %d",sum);
    return 0;
}
/**********************************/

Thanks in advance...

Offline marcelinux

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Intel Cilk Plus
« Reply #1 on: June 09, 2015, 06:15:22 pm »
I just need learn a little bit more. Thank you for your help.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Intel Cilk Plus
« Reply #2 on: June 09, 2015, 06:32:17 pm »
Try reading and following the FAQs http://wiki.codeblocks.org/index.php?title=FAQ

If that fails, then, I would follow the other poster suggestion of reading the manual or at least posting the error message you get!

Edit: CB and GCC version info will likely be needed!

Edit2: Offsite link you may need to read http://www.cyberciti.biz/tips/compile-32bit-application-using-gcc-64-bit-linux.html

Tim S.
 
« Last Edit: June 09, 2015, 07:15:09 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Intel Cilk Plus
« Reply #3 on: June 09, 2015, 07:34:26 pm »
Got the code to compile.

Code
-------------- Build: Release in Cilk Plus (compiler: i586-linux-gnu_gcc4.9)---------------

gcc -Wall -fcilkplus -O2 -m32  -c "/home/stahta01/CB_Work/Intel Cilk Plus/main.c" -o obj/Release/main.o
gcc -L/usr/lib/gcc/i586-linux-gnu/4.9/64 -L/usr/lib/gcc/i586-linux-gnu/4.9 -o "bin/Release/Intel Cilk Plus" obj/Release/main.o  -s -m32  -lcilkrts
Output file is bin/Release/Intel Cilk Plus with size 4.98 KB

1. Most important if using GCC 4.9 under Debian 8.0 (64 bit) is to have this package installed g++-multilib
(Likely true for GCC 4.8; likely untrue for GCC 4.7 or older)
2. Need option "-m32" in both compiler and linker other options.
3. Change the linker from g++ to gcc in CB toolchain settings

Tim S.
« Last Edit: June 10, 2015, 12:07:22 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org