User forums > Embedded development
Intel Cilk Plus
(1/1)
ashiq_rahman:
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...
marcelinux:
have you tried this? http://www.codeblocks.org/docs/main_codeblocks_en.html
stahta01:
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.
stahta01:
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
--- End code ---
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.
Navigation
[0] Message Index
Go to full version