Skip to main content

7.2) Compiling And Submitting OpenMP Jobs


Within a program, parallel directives are included by a sentinel or pragma:

For Fortran: !$ OMP <directive>
For C: #pragma omp <directive>

For example, to give a directive to parallelise a loop in Fortran:

!$OMP PARALLEL DO
	do i=1,256
		z(i) = x(i) + y(i)
	end do
!$OMP END PARALLEL DO

The first directive specifies that the loop should be executed in parallel and the second directive, is given to end the parallel region.