| 1 | = OpenMP FORTRAN = |
| 2 | == Hello World == |
| 3 | {{{#!fortran |
| 4 | !hello_omp.f90: display a message on the screen |
| 5 | program helloworld |
| 6 | use omp_lib |
| 7 | ! |
| 8 | integer::id, nthreads |
| 9 | print *, "F90 Start" |
| 10 | ! |
| 11 | !$omp parallel private(id) |
| 12 | id = omp_get_thread_num() |
| 13 | print *,"hello from ", id |
| 14 | !$omp barrier |
| 15 | if (id == 0) then |
| 16 | nthreads = omp_get_num_threads(); |
| 17 | print *,nthreads," threads said hello!" |
| 18 | endif |
| 19 | !$omp end parallel |
| 20 | print *, "End" |
| 21 | end program helloworld |
| 22 | }}} |
| 23 | |
| 24 | == Compile with GNU Fortran == |
| 25 | {{{gfortran hello_omp.f90 -fopemp}}} |
| 26 | |
| 27 | == Compile with PGI Fortran == |
| 28 | {{{pgf90 hello_omp.f90 -mp}}} |
| 29 | |
| 30 | == Compile with Intel Fortran == |
| 31 | {{{ifort hello_omp.f90 -openmp}}} |
| 32 | |
| 33 | == Examples of Jobscript == |
| 34 | [[https://wiki.hpc.tulane.edu/trac/wiki/cypress/Programming/Cexamples#ExamplesofJobscript|See Example]] |