Can not build an example of intel cilk ++ sdk

Can not build an example of intel cilk ++ sdk

Hello

I installed the intel cilk ++ sdk. i begin to build and run the qsort example (Intel Cilk++ SDK Programmer's Guide).

But i have errors when executing the command make :

root@ubuntu:/usr/local/INSTALLDIR/examples/qsort# make
cilk++ qsort.cilk -O1 -g -lcilkutil -o qsort
/usr/local/INSTALLDIR/bin/cilk++: 3: Syntax error: "(" unexpected
make: *** [qsort] Erreur 2
root@ubuntu:/usr/local/INSTALLDIR/examples/qsort#

Im working on ubunto 11.04 with gcc 4.2.4 :

root@ubuntu:/usr/local/INSTALLDIR/examples/qsort# gcc -v
Utilisation des specs internes.
Target: i486-linux-gnu
Configur avec: ../gcc-4.2.4/configure --prefix=/usr/gcc42 --program-suffix=42 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-linux-gnu --host=i486-linux-gnu
Modle de thread: posix
version gcc 4.2.4
root@ubuntu:/usr/local/INSTALLDIR/examples/qsort#

the error (usr/local/INSTALLDIR/bin/cilk++: 3: Syntax error: "(" unexpected) is generated for all the examples.

Have you any idea for this problem ??

Thank you a lot

17 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Amina,

I'm running Ubuntu 11.10. I downloaded the SDK and tried to build the qsort example. It successfully compiled the source code, and died at the link phase:

willtor:qsort[52] make
cilk++ qsort.cilk -O1 -g -lcilkutil -o qsort
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
make: *** [qsort] Error 1

It looks like there has been some bit-rot since we haven't built a copy of cilk++ in a couple of years. You can rebuild it from source and see if that works. But I recommend that you try the Cilk Plus implementation in ICC or in the cilkplus branch in GCC. Cilk Plus is a little easier to use than Cilk++ was, and (more importantly) theimplementations are up-to-date.

Thank you for your reply.
So, i download the gccc 4.7 because the intel cilk plus requires it.

But when i execute make command, i have the following errors

...
/usr/include/unistd.h:275:21: erreur: two or more data types in declaration specifiers
make[4]: *** [mf-hooks1.lo] Erreur 1
make[4]: quittant le rpertoire /home/dell/Bureau/gcc-4.7-20110806/i686-pc-linux-gnu/libmudflap
make[3]: *** [all-recursive] Erreur 1
make[3]: quittant le rpertoire /home/dell/Bureau/gcc-4.7-20110806/i686-pc-linux-gnu/libmudflap
make[2]: *** [all] Erreur 2
make[2]: quittant le rpertoire /home/dell/Bureau/gcc-4.7-20110806/i686-pc-linux-gnu/libmudflap
make[1]: *** [all-target-libmudflap] Erreur 2
make[1]: quittant le rpertoire /home/dell/Bureau/gcc-4.7-20110806
make: *** [all] Erreur 2
root@ubuntu:/home/dell/Bureau/gcc-4.7-20110806#

have you a fix for this ?

Thanks in advance.

Hello Amina,
Can you please try using the latest gcc-4.7 snapshotfrom this link: http://gcc.gnu.org/git/?p=gcc.git;a=snapshot;h=90e7cf8c6f8bb1ad957f3bc5f...

Also, if you have troubles with libmudflap, please configure it using --disable-mudflap.

Thanks,

Balaji V. Iyer.

Hello, Balaji,

I install the version 10.04 of ubunto, by default gcc 4.4.3.

I download the gcc-4.7 snapshot from the link ("http://gcc.gnu.org/git/?p=gcc.git;a=snapshot;h=90e7cf8c6f8bb1ad957f3bc5f...")

I execute the following commands :

./configure --with-gmp=FOLDER --with-mpfr=FOLDET --with-mpc=FOLDER
make

*FOLDER means the path of gmp, mpfr and mpc install folder

I have errors when executing make.

configure:3734: /home/amina/Bureau/logiciels/gcc-4.7-20110709/host-i686-pc-linux-gnu/gcc/xgcc -B/home/amina/Bureau/logiciels/gcc-4.7-20110709/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -c -g -O2 conftest.c >&5
conftest.c:9:6: error: fixed-point types not supported for this target
configure:3734: $? = 1

Have you a fix for this problem ?

Thank you,

It is a good practice to keep the build directory seperate from the source directory.

Also, why are you still using gcc-4.7 from 2011/07/09 ? I don't think we released a copy on July 9th. Please download the newest copy from my last post and try building.

Please delete all the source that you have and then download a new copy and try the following steps:

Create a new directory called (b-gcc). This directory is called the build-directory.
Copy MPFR to /mpfr
Copy MPC to /mpc
Copy GMP to /gmp

Go into build directory and type the configure command (but do /configure instead of ./configure). Please don't use --with-mpfr, --with-mpc or --with-gmp.

Then try to make. Please let me know if it works fine.

Thanks,

Balaji V. Iyer.

Sorry i let the error from 2011/07/09.

But, it's the same error for the new link. from the config.log file:

configure:3912: /home/amina/Bureau/logiciels/gcc-90e7cf8/host-i686-pc-linux-gnu/gcc/xgcc -B/home/amina/Bureau/logiciels/gcc-90e7cf8/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -E conftest.c
conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory
...
configure:4212: /home/amina/Bureau/logiciels/gcc-90e7cf8/host-i686-pc-linux-gnu/gcc/xgcc -B/home/amina/Bureau/logiciels/gcc-90e7cf8/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:55:12: error: size of array 'test_array' is negative

I will follow the new steps that you suggest.

I will tell you for the result and i hope that works.

Thank you,

Hello,

I followed the steps :

-i create a folder "sources" where i put this folders :

root@amina-laptop:/home/amina/Bureau/sources# ls
bison flex gcc-47 gmp mpc mpfr

Then, I create another folder b-gcc.

I execute this commands :
../sources/gcc-47/configure
make

the command make fails, I have errors on config.log file :

configure:5644: result: no
configure:5658: checking for version 0.11 (revision 0 or later) of PPL
configure:5675: gcc -c -g -O2 conftest.c >&5
conftest.c:10:19: error: ppl_c.h: No such file or directory
conftest.c: In function 'main':
conftest.c:16: error: 'choke' undeclared (first use in this function)
conftest.c:16: error: (Each undeclared identifier is reported only once
conftest.c:16: error: for each function it appears in.)
conftest.c:16: error: expected ';' before 'me'
configure:5675: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h. */
| #include "ppl_c.h"
| int
| main ()
| {
|
| #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
| choke me
| #endif
|
| ;
| return 0;
| }

May be, there is a wrong on the steps that i follow ?

Thank you for your help,

I guess that i have to install PPL libraries :

http://www.cs.unipr.it/ppl/Download/

I installed PPL v0.11

Now, i have the following errors :

configure:4969: gcc -c conftest.c >&5
conftest.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'
configure:4969: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "the Parma Polyhedra Library"
| #define PACKAGE_TARNAME "ppl"
| #define PACKAGE_VERSION "0.11.2"
| #define PACKAGE_STRING "the Parma Polyhedra Library 0.11.2"
| #define PACKAGE_BUGREPORT "ppl-devel@cs.unipr.it"
| #define PACKAGE_URL ""
| #define PPL_CONFIGURE_OPTIONS ""
| /* end confdefs.h. */
|
| #ifndef __INTEL_COMPILER
| choke me
| #endif
|
configure:4974: result: no

....

configure:5394: g++ -c conftest.cpp >&5
conftest.cpp:12: error: 'choke' does not name a type
configure:5394: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "the Parma Polyhedra Library"
| #define PACKAGE_TARNAME "ppl"
| #define PACKAGE_VERSION "0.11.2"
| #define PACKAGE_STRING "the Parma Polyhedra Library 0.11.2"
| #define PACKAGE_BUGREPORT "ppl-devel@cs.unipr.it"
| #define PACKAGE_URL ""
| #define PPL_CONFIGURE_OPTIONS ""
| /* end confdefs.h. */
|
| #ifndef __INTEL_COMPILER
| choke me
| #endif

Have you any idea for this problem ?

Thank you in advance.

Hello Amina,
I guess the best test would be to download a copy of GCC 4.7 from the GCC website, possibly the latest, and do the steps I mentioned to see if it works fine. Please note that i am not talking about GCC from Cilk Plus branch, but the GCC master release (here is a direct link: ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/snapshots/4.7-20111022/gcc-4.7-20111022.tar.bz2) If that does not build, then please contactthe gcc mailing list for help. A lot of GCC experts and users follow those and they can guide you better.

From what I understand,GMP is not put in the correct directory (or the configure is not recognizing the library).Can you please go into theGCC source directory and type"ls" andsend that to me?

Thanks,

Balaji V. Iyer.

Sorry Balaji, i think that i confused between gcc master and gcc from cilkplus branch.

I need to use the cilk plus (http://software.intel.com/en-us/articles/download-intel-cilk-plus-source/) to parallize a program using the work stealing scheduler.

so, it requires the "cilkplus" branch of GCC 4.7.

Thank you for your note.

Now, i have to install "cilkplus" branch ? i don't find a link to download it.

Thank you too much for your help,

Here is a quick note about master and cilkplus GCC....

When we start a GCC project (not a minor one), the GCC community can open a branch for you (there are several examples of such projects in the GCC). This is how Cilk Plus GCCis done. The master branch is the mainline GCC. If you download GCC directly from the website, you get the mainline GCC. This does NOT contain any Cilk Plus features. If you want to use the CilkPlus features,you have to download a copy from theCilk Plus branch. This link(http://gcc.gnu.org/git/?p=gcc.git;a=snapshot;h=90e7cf8c6f8bb1ad957f3bc5f8bdbb0809581074;sf=tgz) willgive you a latest copy of the CilkPlus GCC.

Here is a detailed tutorial about how to build it (Please note that the whole process takes a long time and approximately 1.5 GB of diskspace):

1.Download the gcc sources and save it in a directory called $HOME/gcc-4.7. The final compiler executables and the appropriate libraries will be stored in $HOME/cilkplus-install .

2.Copy the gmp, mpc and mpfr directories to the $HOME/gcc-4.7/ directory.

3.Create a new directory called "b-gcc" under $HOME/. This directory will hold all the object files. You may delete this directory after the successful completion of all the steps in this tutorial.

4.Go to the b-gcc directory and type the following command:

$HOME/gcc-4.7/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++"

The above command will configure the compiler makefiles to set the install directory to be $HOME/cilkplus-install and build just the C and C++ compilers.

5.Type "make" in the same directory. This command will build the compiler sources. This will probably take quite a while.

6.Type "make install" . This command will copy the compiler executables and the required libraries to the install directory.

The compilers (g++ and gcc) should now be in the $HOME/cilkplus-install/bin directory.

To use the GCC Cilk Plus compiler, it needs to be in your PATH and the libraries need to be in your LIBRARY_PATH and LD_LIBRARY_PATH. The following commands can be used (in a BASH Shell) to accomplish this:

export LD_LIBRARY_PATH=$HOME/cilkplus-install/lib

export LIBRARY_PATH=$HOME/cilkplus-install/lib

Building a Cilk Plus application with the GCC compilers requires explicitly linking with libcilkrts, and libdl. For example:

$HOME/cilkplus-install/bin/gcc -ldl -lcilkrts

$HOME/cilkplus-install/bin/g++ -ldl -lcilkrts

Hello Belaji,

Thank you very much for your help.
I follow the steps (1 -> 6), it works fine :)
The compilers (g++ and gcc) are now in the .../cilkplus-install/bin :

root@amina-laptop:/home/amina/projet/cilkplus-install/bin# ls
c++ cpp g++ gcc gcov i686-pc-linux-gnu-c++ i686-pc-linux-gnu-g++ i686-pc-linux-gnu-gcc i686-pc-linux-gnu-gcc-4.7.0

I add the cilkplus compiler to LIBRARY_PATH and LD_LIBRARY_PATH :

root@amina-laptop:/home/amina/projet/cilkplus-install/bin# echo $LIBRARY_PATH
/home/amina/projet/cilkplus-install/lib
root@amina-laptop:/home/amina/projet/cilkplus-install/bin# echo $LD_LIBRARY_PATH
/home/amina/projet/cilkplus-install/lib

Now, i have to install the cilk plus runtime (libcilkrts.so runtime library), i follow the steps mentionned on the readme.txt :

% libtoolize
% aclocal
% automake --add-missing
% autoconf
% ./configure
% make
% make install

The make command fails with the following errors :

...
runtime/worker_mutex.h:50: error: redefinition of typedef '__cilkrts_worker'
./include/internal/abi.h:94: note: previous declaration of '__cilkrts_worker' was here
In file included from runtime/cilk-abi.c:43:
runtime/global_state.h:210: error: redefinition of typedef 'global_state_t'
./include/internal/abi.h:99: note: previous declaration of 'global_state_t' was here
In file included from runtime/cilk-abi.c:44:
runtime/os.h:84: error: redefinition of typedef '__cilkrts_worker'
runtime/worker_mutex.h:50: note: previous declaration of '__cilkrts_worker' was here
runtime/os.h:85: error: redefinition of typedef 'cilkred_map'
./include/internal/abi.h:101: note: previous declaration of 'cilkred_map' was here
In file included from runtime/cilk-abi.c:47:
runtime/local_state.h:237: error: redefinition of typedef 'local_state'
./include/internal/abi.h:100: note: previous declaration of 'local_state' was here
In file included from runtime/cilk-abi.c:48:
runtime/full_frame.h:49: error: redefinition of typedef '__cilkrts_stack_frame'
./include/internal/abi.h:96: note: previous declaration of '__cilkrts_stack_frame' was here
runtime/full_frame.h:50: error: redefinition of typedef '__cilkrts_stack'
runtime/global_state.h:55: note: previous declaration of '__cilkrts_stack' was here
In file included from runtime/scheduler.h:51,
from runtime/cilk-abi.c:49:
runtime/reducer_impl.h:51: error: redefinition of typedef 'cilkred_map'
runtime/os.h:85: note: previous declaration of 'cilkred_map' was here
In file included from runtime/sysdep.h:53,
from runtime/cilk-abi.c:50:
runtime/cilk-tbb-interop.h:145: error: redefinition of typedef '__cilk_tbb_stack_op_thunk'
runtime/os.h:60: note: previous declaration of '__cilk_tbb_stack_op_thunk' was here
In file included from runtime/cilk-abi.c:50:
runtime/sysdep.h:58: error: redefinition of typedef '__cilkrts_region_properties'
./include/internal/inspector-abi.h:71: note: previous declaration of '__cilkrts_region_properties' was here
runtime/cilk-abi.c: In function '__cilkrts_leave_frame':
runtime/cilk-abi.c:229: error: '__cilkrts_stack_frame' has no member named 'spawn_helper_pedigree'
runtime/cilk-abi.c:230: error: '__cilkrts_stack_frame' has no member named 'spawn_helper_pedigree'
make: *** [cilk-abi.lo] Erreur 1
root@amina-laptop:/home/amina/projet/cilkplus-install#

May be i forget something!!

Have you an idea ??

Thank you in advance,

Hi Amina,
You DO NOT need to do these steps... thisis why you are getting problems.
=================================================================

Now, i have to install the cilk plus runtime (libcilkrts.so runtime library), i follow the steps mentionned on the readme.txt :

% libtoolize

% aclocal

% automake --add-missing

% autoconf

% ./configure

% make

% make install
==========================================================

If you check /home/amina/projet/cilkplus-install/lib directory, you will find a libcilkrts.so.5 file. This is all you need. The readme that you are talking about is to install JUST the runtime WITHOUT the compiler.

Ah ok, yes i found the libcilkrts.so.5 on the lib directory :

root@amina-laptop:/home/amina/projet/cilkplus-install/lib# ls
gcc libgomp.la libmudflap.so.0 libquadmath.so libssp.so.0.0.0
libcilkrts.a libgomp.so libmudflap.so.0.0.0 libquadmath.so.0 libstdc++.a
libcilkrts.la libgomp.so.1 libmudflapth.a libquadmath.so.0.0.0 libstdc++.la
libcilkrts.so libgomp.so.1.0.0 libmudflapth.la libssp.a libstdc++.so
libcilkrts.so.5 libgomp.spec libmudflapth.so libssp.la libstdc++.so.6
libcilkrts.so.5.0.1857 libiberty.a libmudflapth.so.0 libssp_nonshared.a libstdc++.so.6.0.17
libgcc_s.so libmudflap.a libmudflapth.so.0.0.0 libssp_nonshared.la libstdc++.so.6.0.17-gdb.py
libgcc_s.so.1 libmudflap.la libquadmath.a libssp.so libsupc++.a
libgomp.a libmudflap.so libquadmath.la libssp.so.0 libsupc++.la

I'm trying to build an example that i found it on the Intel Cilk Plus SDK (Software Development Kit) examples directory : the qsort example :

root@amina-laptop:/home/amina/projet/cilkplus-install/bin# gcc -ldl -lcilkrts ../examples/qsort-race/qsort-race.cpp
../examples/qsort-race/qsort-race.cpp: In function void qsort(T, T):
../examples/qsort-race/qsort-race.cpp:51: error: _Cilk_spawn was not declared in this scope
../examples/qsort-race/qsort-race.cpp:51: error: expected ; before qsort
../examples/qsort-race/qsort-race.cpp:54: error: _Cilk_sync was not declared in this scope

template void qsort(T begin, T end)
{
if (begin != end) {
T middle = partition(begin, end,
bind2nd(less::value_type>(),
*begin));

cilk_spawn qsort(begin, middle);
// INTENTIONAL RACE: MIDDLE-1 should be MIDDLE
qsort(max(begin + 1, middle - 1), end);
cilk_sync;
}
}

Have you an idea why there are errors when building the qsort example ?

Thank you in advance,

Hello Balaji,

The problem is resolved :

I have to edit my symbolic links in /usr/bin to refer to the new gcc branch. Here's a
script I wrote to do so:

ln -sf /home/amina/projet/cilkplus-install/bin/g++ /usr/bin/g++
ln -sf /home/amina/projet/cilkplus-install/bin/gcc /usr/bin/gcc

It compiles without errors and i have as result the a.out file :

amina@amina-laptop:~/projet/cilkplus-install/examples/fibonacci$ gcc -ldl -lcilkrts fibonacci.cpp
amina@amina-laptop:~/projet/cilkplus-install/examples/fibonacci$ ls
a.out fibonacci.cpp

Thank you so much.

Leave a Comment

Please sign in to add a comment. Not a member? Join today