seems I am able to access all the OpenMP functions by just including omp.h.
Tried running the example:
Code:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
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);
nmaxthreads=omp_get_max_threads();
printf("numri maksimal i threadeve eshte = %d\n", nmaxthreads);
/* Only master thread does this */
if (tid == 0)
{
nthreads = omp_get_num_threads();
nproc =omp_get_num_procs();
printf("Number of threads = %d\n", nthreads);
printf("Number of processors = %d\n", nproc);
}
} /* All threads join master thread and disband */
}
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.
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