How to access Cilk runtime information within cilk program

How to access Cilk runtime information within cilk program

I want to access Cilk runtime information within the Cilk program.
I want to know how many threads are created by Cilk runtime........
Can any body help me?

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

By default, the runtime will create a number of workers equal to the number of cores in your computer. You can specify a different value with the environment variable: CILK_NPROC, or if you are using cilk_main(), you can specify the argument "-cilk_set_nworkers=n" on the command line.

cilk::current_worker_count() will tell you how many workers the runtime created.

- Barry

Hi Barry,

I tried to use cilk:current_worker_count() in Intel Parallel studio and I got this error.

"cilk" has no member "current_worker_count"

Is this because the new CILK Plus take away this member from the cilk.h?

Do you know any replacement from the current cilk.h?

Kay Seah

If you're using Intel Cilk Plus, which is part of the Intel C/C++ compiler, then the cilk:: class has been replaced by the API in cilk/cilk_api.h . The new function is

int __cilkrts_get_nworkers(void);

Since Intel Cilk Plus supports both C and C++, this is a simple global function. For example:

int nworkers = __cilkrts_get_nworkers();

There is a document on converting an application from Cilk++ to Intel Cilk Plus at .

- Barry

Leave a Comment

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