seems I am able to access all the OpenMP functions by just including omp.h.
Tried running the example:
But it only prints once and says I have 1 thread. Running the function omp_get_max_threads() or omp_get_num_procs() says I have 4 though. Using omp_set_num_threads() doesn't change anything.
int main (int argc, char *argv)
int nthreads, tid,nproc,nmaxthreads;
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel num_threads(4)
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);
printf("numri maksimal i threadeve eshte = %d\n", nmaxthreads);
/* Only master thread does this */
if (tid == 0)
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
printf("Number of processors = %d\n", nproc);
} /* All threads join master thread and disband */
Then I turned on OpenMP Support in Properties\C/C++\Language\OpenMP Support
I also set the enviromental variable name: OMP_NUM_THREADS, value 4.
The plugin is compiled as a Multi-threaded DLL (/MD).
What's wrong in my settings ??? help please