S
san
Hi,
I am not sure whether this is the right group to post this. Still here
I go:
I am new to OpenMP. I wrote a very simple code in C++.
The code is as below
#include <iostream.h>
#include <omp.h>
int main()
{
int nthreads, tid;
#pragma omp parallel num_threads(4)
{
int i = omp_get_thread_num();
cout << "Hello from thread " << i << endl;
}
return 0;
}
The output is:
Hello from thread 0
I am getting that line printed only once. Means there is only one
thread i.e. master thread.
What could be the reason for this. In what cases num_thread() or
omp_set_num_threads() fails.
Thanks.
I am not sure whether this is the right group to post this. Still here
I go:
I am new to OpenMP. I wrote a very simple code in C++.
The code is as below
#include <iostream.h>
#include <omp.h>
int main()
{
int nthreads, tid;
#pragma omp parallel num_threads(4)
{
int i = omp_get_thread_num();
cout << "Hello from thread " << i << endl;
}
return 0;
}
The output is:
Hello from thread 0
I am getting that line printed only once. Means there is only one
thread i.e. master thread.
What could be the reason for this. In what cases num_thread() or
omp_set_num_threads() fails.
Thanks.