apparently no parallel execution under Suse 10.1

Hello,

I have experienced a strange behaviour of pgi6.2-5 on Suse 10.1. It seems that -mp does not work at all. Unless expected, no subthreads are created although the program enters the parallel region.

I would eppreciate your help very much. Please give advise:

The following program was compiled without warnings nor errors under 10.1 and 9.3 with

pgcc -mp simple.c


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

int main() {

#pragma omp parallel num_threads(8)
{
printf(“threadnum=%d pid=%d ppid=%d\n”, omp_get_thread_num(), getpid(), getppid());
}




The Suse 9.3 output is reasonable, each thread has its unique pid:

}Warning: omp_set_num_threads (8) greater than available cpus (1)
threadnum=0 pid=13156 ppid=12945
threadnum=4 pid=13161 ppid=13157
threadnum=6 pid=13163 ppid=13157
threadnum=2 pid=13159 ppid=13157
threadnum=5 pid=13162 ppid=13157
threadnum=1 pid=13158 ppid=13157
threadnum=7 pid=13164 ppid=13157
threadnum=3 pid=13160 ppid=13157


Under Suse 10.1 64 and 32 bit, however, pid is the same for each thread:

Warning: omp_set_num_threads (8) greater than available cpus (2)
threadnum=0 pid=19610 ppid=9481
threadnum=2 pid=19610 ppid=9481
threadnum=1 pid=19610 ppid=9481
threadnum=3 pid=19610 ppid=9481
threadnum=4 pid=19610 ppid=9481
threadnum=5 pid=19610 ppid=9481
threadnum=6 pid=19610 ppid=9481
threadnum=7 pid=19610 ppid=9481

Hi Vitali,

On old linux systems (pre-NPTL), each thread was a process in the same address space. With the New Posix Thread Library, a thread is a thread in the same process. NPTL is an improvement. To see the thread’s id use “long pthread_self()”.

% cat simple.c
#include <stdio.h>
#include <omp.h>

int main() {

#pragma omp parallel num_threads(8)
{
   printf("threadnum=%d pid=%d ppid=%d pself=%ld\n", 
         omp_get_thread_num(), getpid(), getppid(), pthread_self());
}
}
% pgcc -mp simple.c -o simple.out
% simple.out
threadnum=2 pid=26298 ppid=25134 pself=1077942624
threadnum=0 pid=26298 ppid=25134 pself=2871547616
threadnum=1 pid=26298 ppid=25134 pself=1075841376
threadnum=3 pid=26298 ppid=25134 pself=1080043872
threadnum=4 pid=26298 ppid=25134 pself=1082145120
threadnum=6 pid=26298 ppid=25134 pself=1086347616
threadnum=7 pid=26298 ppid=25134 pself=1088448864
threadnum=5 pid=26298 ppid=25134 pself=1084246368
  • Mat

Hi Mat,

thank you very much for your helpful explanation.

Best regards,

Vitali