Software Archive
Read-only legacy content
17061 Discussions

cilk/cilk.h: no such file or directory

Ryan_M_3
Beginner
3,215 Views

I thought I start a new thread since it doesn't pertain to the bug anymore. I am getting this: 

cute_rj@Cute:~/code/src/sort/build$ make
g++ -std=c++0x -O2 -DHAVE_OPENMP=1 -DHAVE_CILKPLUS=1 -fcilkplus -lcilkrts -I.. ../common/test_sort.cpp -ltbb -lgomp -lrt -o test_sort.x
../common/test_sort.cpp:9:23: fatal error: cilk/cilk.h: No such file or directory
#include <cilk/cilk.h>
^
compilation terminated.
make: *** [test_sort.x] Error 1

and yes my environment variables are set!

cute_rj@Cute:~/code/src/sort/build$ echo $PATH
/home/cute_rj/gcc-cilk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
cute_rj@Cute:~/code/src/sort/build$ echo $LIBRARY_PATH
/home/cute_rj/gcc-cilk/lib
cute_rj@Cute:~/code/src/sort/build$ echo $LD_LIBRARY_PATH
/home/cute_rj/gcc-cilk/lib

What the heck is going on? -.- lol

0 Kudos
17 Replies
Barry_T_Intel
Employee
3,215 Views

You have two options:

  1. You can add a -I (capital i) option to add to the list of directories that will be searched for include files. For example,
    g++ -std=c++0x -O2 -DHAVE_OPENMP=1 -DHAVE_CILKPLUS=1 -fcilkplus -lcilkrts -I.. \
    -I/home/cute_rj/gcc-cilk/include../common/test_sort.cpp -ltbb -lgomp -lrt -o test_sort.x

  2. You can define CPATH (or  CPLUS_INCLUDE_PATH) to specify the list of directories that will be searched for include files.  For example:
       export CPATH=/home/cute_rj/gcc-cilk/include:$CPATH

I don't believe that g++ will automatically add the directory to the include file search path when you use the -fcilkplus.

   - Barry

0 Kudos
Ryan_M_3
Beginner
3,215 Views

Didn't work but i did look at the snapshot provided by cilkplus.org and i see that i'm missing my libcilkrts directory -.- thats where the cilk.h file is

0 Kudos
Ryan_M_3
Beginner
3,215 Views

aha! found my problem. let me see if that fixes it

0 Kudos
Barry_T_Intel
Employee
3,215 Views

I hadn't realized that you were running from the snapshot at http://www.cilkplus.org/node/78#gcc-development-branch . If there is a problem there, of if I should update the "how to build with the Cilk Plus extension", please let me know.

   - Barry

0 Kudos
Ryan_M_3
Beginner
3,215 Views

i wasn't running from snapshot xD it was more of a guide sir

0 Kudos
Lokesh_P_
Beginner
3,215 Views

Hello guys

I am also having the same problem ' cilk/cilk.h' file not found. I set my environment variables correctly and checked twice. It all seems fine but libcilkrts is missing. Can anyone tell me how to add this libcilkrts runtime library to LLVM's Clang.

Thank you

0 Kudos
Barry_T_Intel
Employee
3,215 Views

You'll need to use the LLVM/Clang from the CilkPlus/LLVM project on GitHub.  See http://www.cilkplus.org/which-license#llvm-development .

     - Barry

0 Kudos
Lokesh_P_
Beginner
3,215 Views

The installation and the downloading gonna take too much time, isn't there any way to fix the libcilrts problem in LLVM's Clang.?

0 Kudos
Barry_T_Intel
Employee
3,215 Views

Cilk Plus is not in the mainline version of LLVM/Clang. The only version that supports Cilk Plus is the one from the CilkPlus/LLVM project.

   - Barry

0 Kudos
Lokesh_P_
Beginner
3,215 Views

Hi is there any easy way I could download these cilkplus files in a short time from http://gcc.gnu.org/svn/gcc/branches/cilkplus link?please suggest

 

0 Kudos
Barry_T_Intel
Employee
3,215 Views

The snapshots download in a reasonable time. Follow the links in http://www.cilkplus.org/build-gcc-cilkplus under "Using a snapshot". You'll get a compressed tarball of the latest build in the branch.

   - Barry

0 Kudos
Lokesh_P_
Beginner
3,215 Views

hey Barry,

Thank you for helping me. But at last stage where building Cilkplus application with GCC compilers requires explicitly enabling the Cilk Plus extension and linking with libcilkrts. For example:

$HOME/cilkplus-install/bin/gcc -fcilkplus -lcilkrts <OTHER_FLAGS> <SRC_FILES>
$HOME/cilkplus-install/bin/g++ -fcilkplus -lcilkrts <OTHER_FLAGS> <SRC_FILES>,What this says and what is the meaning of OTHER_FLAGS here!!!!!

One more thing I am doing my final year project based on this topic. Can you suggest me some problems in which I can show the parallelism.

Thank you.

0 Kudos
Ryan_M_3
Beginner
3,215 Views

Other flags are the flags you use when compiling your files. Such as -o and -g

0 Kudos
Lokesh_P_
Beginner
3,215 Views

Ok

Can you suggest me some standard problems on which I can work on and enjoy this concept.

0 Kudos
Barry_T_Intel
Employee
3,215 Views

You might want to look at the problems from "Structured Parallel Programming" by Michael McCool, James Reinders and Arch Robison. The sources are available at http://parallelbook.com/downloads .

You might also look at some of the examples at the http://cilkplus.org website.

   - Barry

0 Kudos
Lokesh_P_
Beginner
3,215 Views

Hey everyone I have a very silly doubt.

I am compiling my file using :

/home/aryan/cilkplus-install/bin/gcc -fcilkplus -lcilkrts -o test tes.c

the compilation done succesfully, and runs too. But what is the meaning of -fcilkplus and -lcilkrts here!!!!!!.

And to run a program I am using

CILK_NWORKER=1 time ./test. What this line says? Please reply.

0 Kudos
Barry_T_Intel
Employee
3,215 Views

-fcilkplus enables the Cilk Plus extension.

-lcilkrts tells the compiler to add libcilkrts.so to the list of libraries that are linked against.

The statement "CILK_NWORKER=1 time ./test." is doing 3 things:

  1. It's setting the environment variable CILK_NWORKERS to "1". This tells the Cilk runtime to only use one worker, so there's only 1 thread to do the work. If you don't do this, the Cilk runtime will use as many workers as your system has logical cores - Assuming you're using Linux, the number of cores in the /proc/cpuinfo file. The environment variable is only set for the duration of the command.
  2. It's timing the run of your application. When the application completes, you should see output specifying how long your application ran.  You can use the command "man time" to see the "time" man page which has all the details.
  3. It's running the application "test" from the current directory.

   - Barry

0 Kudos
Reply