openmp

At first please allow me to put a little question in CUDA Forums.

I have a problem about using openmp multi-thread in a multi-processor cluster.
This is a simple program as shown below.
If I execute it as a simple hello world program, it works.
However, if I put the same code in my application, it gives me
4 threads on root node but only 1 thread on other nodes.

#include <stdio.h>
#include <omp.h>

int main(int argc, char **argv)
{
int iam=0, np=1;
#pragma omp parallel default(shared) private(iam, np)
{
#if defined (_OPENMP)
np = omp_get_num_threads();
iam = omp_get_thread_num();
#endif
printf(“Hello from thread %d out of %d\n”, iam, np);

if (iam==2)
	printf("OK iam=%d\n",iam);
}

}

what I got by executing my application with this code:

Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 3 out of 4
Hello from thread 0 out of 1
Hello from thread 0 out of 1
Hello from thread 0 out of 1
Hello from thread 0 out of 1
Hello from thread 0 out of 1
Hello from thread 0 out of 1
Hello from thread 0 out of 1

What I got just execute the simple hello world program:
Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 0 out of 4
Hello from thread 3 out of 4
Hello from thread 0 out of 4
Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 0 out of 4
Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 3 out of 4
Hello from thread 3 out of 4
Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 3 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 0 out of 4
Hello from thread 1 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 1 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 1 out of 4
Hello from thread 3 out of 4
Hello from thread 3 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 1 out of 4
Hello from thread 3 out of 4
Hello from thread 2 out of 4
OK iam=2
Hello from thread 2 out of 4
OK iam=2
Hello from thread 2 out of 4
OK iam=2
Hello from thread 2 out of 4
OK iam=2
Hello from thread 3 out of 4