Parallel calculations in whole array expressions

56 views
Skip to first unread message

Antonio Serrano

unread,
Jun 28, 2013, 12:41:39 PM6/28/13
to gnu-f...@googlegroups.com
Hello:

   I'm new to fortran and to gfortran. I learned that whole expression arrays are calculated in parallel, but I see that calculations only take place in just one core of my computer.
   I use the following code:
program prueba_matrices

 implicit none
 
 integer, parameter                                          :: num = 100
 double precision, dimension(1:num,1:num)       :: A, B, C
 double precision, dimension (num*num)            :: temp
 integer                                                           :: i
 
 temp = (/ (i/2.0, i=1,num*num) /)
 A = reshape(temp, (/ num, num/) )
 B = reshape(temp, (/ num, num/) )
 do i = 1,1000000
     C = matmul(A , B)
 end do
end program prueba_matrices

   I complie like this:

gfortran prueba_matrices.f03 -o prueba_gfortran

   And, watching the graphs produced in real time by gnome-system-monitor, I can see that there is only one core working. If I substitute the line with the calculation
      C = matmul(A , B)
 for
      C = A * B

   it yields the same behaviour.

  What am I doing wrong.

  Thank you very much.

   Antonio Serrano
   Greetengs from Málaga (Spain)
Reply all
Reply to author
Forward
0 new messages