Intel® C++ Compiler 16.0 User and Reference Guide
int __cilkrts_get_worker_number (void);
The function __cilkrts_get_worker_number returns a small integer indicating the Intel® Cilk™ Plus worker on which the function is executing. The return value is in the range 0 to "__cilkrts_get_nworkers()-1. You can simulate “worker-local storage” by creating an array of size __cilkrts_get_nworkers(), with each element indexed by a worker ID. If more than one user-created thread calls __cilkrts_get_worker_number, they may get identical results (since worker IDs are not unique across user threads). If called in serialized code, __cilkrts_get_worker_number returns zero.