as I was trying to learn openMP , I came across this sample of code
#include < stdio.h>
#include < omp.h> // Include OpenMP
int main(int argc, char **argv)
#pragma omp parallel num_threads(10)
threadNum = omp_get_thread_num();
printf("This is thread %d\n", threadNum);
the author said that it worked correctly print ids from 0-9.
but when I try it ,it only print id 0. i.e, only one thread is running .
knowing that my OS is win7 and processor is Intel icore7
Edited 20-May-11 5:19am
This example is also on the wiki where they use barriers. stdout doesn't have to be thread safe. Have another look at the wiki on this:
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)