I'm using the following command to parallelize a single loop over the available threads of the program:
#pragma omp parallel for num_threads(threads)
for(long i = 0; i < threads; i++)
{
array[i] = calculateStuff(i,...);
}
For technical reasons, I would like to guarantee that thread number 0 executes i=0, and thread number 1 executes i=1. In other words, I want always i=omp_get_thread_num(). Is this possible?