 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
san Guest
|
Posted: Sun Sep 17, 2006 9:10 am Post subject: openMP question |
|
|
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. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|