wiki:cypress/Programming/FortranExamples/OpenMpFortran

OpenMP FORTRAN

Hello World

!hello_omp.f90: display a message on the screen 
program helloworld
  use omp_lib
  !
  integer::id, nthreads
  print *, "F90 Start"
  !
  !$omp parallel private(id) 
  id = omp_get_thread_num()
  print *,"hello from ", id
  !$omp barrier
  if (id == 0) then
     nthreads = omp_get_num_threads();
     print *,nthreads," threads said hello!"
  endif
  !$omp end parallel
  print *, "End"
end program helloworld

Compile with GNU Fortran

gfortran hello_omp.f90 -fopemp

Compile with PGI Fortran

pgf90 hello_omp.f90 -mp

Compile with Intel Fortran

ifort hello_omp.f90 -openmp

Examples of Jobscript

See Example

Last modified 10 years ago Last modified on 05/15/15 10:02:07
Note: See TracWiki for help on using the wiki.