The following test program returns 1 for omp_get_max_threads in a parallel region. This is different from what I get with three other compilers, and hence somewhat unexpected. Is this correct, and if so, should it be the default?
> gfortran -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: /data03/vondele/gcc_4_3_0_release/gcc-4.3.0/configure --prefix=/ext/software/64/gfortran-suite/gcc-4.3.0 --enable-languages=c,c++,fortran Thread model: posix gcc version 4.3.0 (GCC) SUBROUTINE TEST() IMPLICIT NONE INTEGER :: ithread,nthread,mthread !$ INTEGER :: omp_get_thread_num, omp_get_max_threads, omp_get_num_threads ithread=0 nthread=1 mthread=1 !$ nthread=omp_get_max_threads() write(6,*) ithread,nthread,mthread !$OMP PARALLEL PRIVATE(ithread,nthread,mthread) !$ nthread=omp_get_max_threads() !$ mthread=omp_get_num_threads() !$ ithread=omp_get_thread_num() !$OMP CRITICAL write(6,*) ithread,nthread,mthread !$OMP END CRITICAL !$OMP END PARALLEL END SUBROUTINE TEST CALL TEST() END IBM: [EMAIL PROTECTED]:~> xlf90_r -qsuffix=f=f90 -O3 -qsmp=omp test.f90 ** test === End of Compilation 1 === ** _main === End of Compilation 2 === 1501-510 Compilation successful for file test.f90. [EMAIL PROTECTED]:~> ./a.out 0 4 1 0 4 4 1 4 4 3 4 4 2 4 4 [EMAIL PROTECTED]:/data03/vondele/openmp> pgf90 -openmp test.f90 [EMAIL PROTECTED]:/data03/vondele/openmp> ./a.out 0 4 1 0 4 4 1 4 4 2 4 4 3 4 4 [EMAIL PROTECTED]:/data03/vondele/openmp> ifort -O0 -openmp test.f90 test.f90(13): (col. 7) remark: OpenMP DEFINED REGION WAS PARALLELIZED. [EMAIL PROTECTED]:/data03/vondele/openmp> ./a.out 0 4 1 0 4 4 1 4 4 2 4 4 3 4 4 [EMAIL PROTECTED]:/data03/vondele/openmp> gfortran -O0 -fopenmp test.f90 [EMAIL PROTECTED]:/data03/vondele/openmp> ./a.out 0 4 1 0 1 4 1 1 4 2 1 4 3 1 4 -- Summary: OMP atypical results for omp_get_max_threads Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35881