Next step to "hello world" program on learning OpenMP, I started making the following code, such that I can implement on the bigger code which I work on. Unfortunately, I couldn't see any difference across normal, /Qopenmp and /Qparallel options. All uses only one processor out of 4, for any value of n. Of course, beyond certain value of n, virtual memory error is thrown.
Compilation was done in command line with following options using Fortran Compiler 220.127.116.114 in Intel i5-3320M processor (Win 7, 32-bit).
ifort /Qopenmp test.f90 (i see from report that, the do loop was parallelized)
ifort /Qparallel test.f90
Can someone help on, what am I missing?
module mod1 contains subroutine sub1(a,b,c) implicit none real*4, intent(in) :: a,b real*4, intent(out):: c c=a*b end subroutine sub1 end module mod1 program test use omp_lib use mod1 implicit none real*4, allocatable :: a(:), b(:), c(:) integer :: i,n read(*,*) n allocate(a(n),b(n),c(n)) do i=1,n call random_number(a(i)) call random_number(b(i)) end do !$omp do do i=1,n call sub1(a(i),b(i),c(i)) end do !$omp end do write(*,*) a(1),b(1),c(1) end program test