Back to TEA page.
% f77 -mp foo.f
% f90 -omp foo.f90 % f95 -omp foo.f90
% guidef77 foo.f % guidef90 foo.f90 % guidec foo.c % guidec++ foo.cc % assuref77 foo.f % assuref90 foo.f90 % assurec foo.c % assurec++ foo.ccHowever, 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.
% cd /usr/local/KAI/flexlm % ./etc.flex.rcYou 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.
% ompcc foo.c % ompf77 foo.f
% setenv OMP_NUM_THREADS 4or runtime library.
omp_set_num_threads(4);
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
#include <stdio.h>
main()
{
#pragma omp parallel
{
#pragma omp critical
printf("(%d / %d)\n", omp_get_thread_num(), omp_get_num_threads());
}
}
% guidef77 -WGstats -o foo foo.f % ./foo % guideview guide_stats
% assuref77 -project_name=foo -o foo foo.f % ./foo % assureview foo