program main !*****************************************************************************80 ! !! MAIN is the main program for HELLO. ! ! Discussion: ! ! HELLO is a "Hello, World" program for OpenMP. ! ! Licensing: ! ! This code is distributed under the GNU LGPL license. ! ! Modified: ! ! 20 July 2007 ! ! Author: ! ! John Burkardt ! use omp_lib implicit none integer id double precision wtime write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'HELLO' write ( *, '(a)' ) ' FORTRAN90/OpenMP version' wtime = omp_get_wtime ( ) write ( *, '(a,i8)' ) ' The number of processors available = ', omp_get_num_procs ( ) write ( *, '(a,i8)' ) ' The number of threads available = ', omp_get_max_threads ( ) ! ! Have each thread say hello. ! !$omp parallel & !$omp private ( id ) id = omp_get_thread_num ( ) write ( *, '(a,i8,a,i8)' ) ' This is process ', id !$omp end parallel ! ! Finish up by measuring the elapsed time. ! wtime = omp_get_wtime ( ) - wtime write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'HELLO' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' write ( *, '(a,g14.6)' ) ' Elapsed wall clock time = ', wtime stop end