Intel® C++ Compiler 16.0 User and Reference Guide

__cilkrts_set_param

int __cilkrts_set_param(const char* name, const char* value);

This function controls parameters of the Intel® Cilk™ Plus runtime system. The two string parameters form a name/value pair. The following name argument is recognized:

nworkers: The value argument specifies the number of worker threads to use, as a decimal number or, if prefixed by 0x or 0, as a hexadecimal or octal number, respectively. If this function is not called, the worker count is obtained from the CILK_NWORKERS environment variable, if present. Otherwise, the worker count defaults to the number of processors available. This function is effective only before the first call to a function containing a cilk_spawn or cilk_for. If you need precise control over the number of workers, exit the parallel region, shut down the Intel® Cilk™ Plus runtime using __clkrts_end_cilk(), then set the number of workers.

The return value is zero on success and a non-zero value on failure. Failures may be caused by a variety of conditions including an unrecognized argument, an illegal value, or calling at an incorrect time.

For an example using __cilkrts_set_param, see Set Worker Count.

Windows* only: __cilkrts_set_param_w() provides a wide character interface for Windows programmers. Its parameters are the same as __cilkrts_set_param().