OpenMP at ETL

1. Compilation
2. How to specify number of threads
3. Sample programs

Back to TEA page.


1. Compilation

MIPSpro Compiler [o2k]

In the MIPSpro 7.2.1 Compiler, Fortran 77 and Fortran 90 support OpenMP.
% f77 -mp foo.f

Digital UNIX [wiz]

Fortran 90 and Fortran 95 in the Digital UNIX 4.0D support OpenMP.
% f90 -omp foo.f90
% f95 -omp foo.f90

KAI OpenMP [hpc, o2k, wiz]

KAI OpenMP has been also installed on o2k, alpha machines and solaris machines.
% guidef77 foo.f
% guidef90 foo.f90
% guidec foo.c
% guidec++ foo.cc
% assuref77 foo.f
% assuref90 foo.f90
% assurec foo.c
% assurec++ foo.cc
However, on the Sun machines, runtime library name of OpenMP is necessary to end with '_', i.e., omp_get_num_threads() should be replaced by omp_get_num_threads_(). I don't know why.
If license server on hpc is dead, please execute license server.
% cd /usr/local/KAI/flexlm
% ./etc.flex.rc
You can check whether the license server works correctly by the log file /usr/local/KAI/flexlm/lmgrd.log. It may be necessary to change directory to /usr/local/KAI/flexlm/ first before staring lmgrd daemon.

RWCP OMNI OpenMP Compiler [hpc, o2k]

RWCP OMNI OpenMP Compiler is installed on hpc (Enterprise 3000) and o2k (Origin2000).
% ompcc foo.c
% ompf77 foo.f

2. How to specify number of threads

The number of threads can be specified by environment variable,
% setenv OMP_NUM_THREADS 4
or runtime library.
    omp_set_num_threads(4);

3. Sample programs

Fortran

      program openmp_test

      INTEGER OMP_GET_THREAD_NUM, OMP_GET_NUM_THREADS
      INTEGER I, N
!$OMP PARALLEL PRIVATE(I, N)
      I = OMP_GET_THREAD_NUM()
      N = OMP_GET_NUM_THREADS()
!$OMP CRITICAL
      write (*, *) I, N
!$OMP END CRITICAL
!$OMP END PARALLEL

      end

C

#include <stdio.h>

main()
{
#pragma omp parallel
    {
#pragma omp critical
	printf("(%d / %d)\n", omp_get_thread_num(), omp_get_num_threads());
    }
}

4. GuideView

To use guideview(1), it is necessary to link the guide_stats library by specifying the compile option -WGstats.
% guidef77 -WGstats -o foo foo.f
% ./foo
% guideview guide_stats

5. AssureView

The Assure tools validate the correctness of parallel programs annoteted with OpenMP directives and identify programming errors that occurred when parallelizing a sequential program.
% assuref77 -project_name=foo -o foo foo.f
% ./foo
% assureview foo

Osamu Tatebe <tatebe@etl.go.jp>
Last modified: Thu Jan 6 16:32:42 2000