OpenMP 2 Solution

     parameter (n=5000,l=100)
     real*8 t1,t2
     real*8,dimension(n,n):: a,b,c
     real*8,dimension(n):: d

     !$omp parallel
     !$omp workshare
     a=0.5d0
     b=1.d0
     !$omp end workshare

     !$omp do private (i)
     do i=1,n
     a(i,i)=real(i)
     end do
     !$omp end do

     !$omp do private (i)
     do i=1,n
     b(i,i)=sin(i*0.5)
     end do
     !$omp end do

     t1=omp_get_wtime()
     !$omp workshare
     c=matmul(a,b)
     !$omp end workshare
     t2=omp_get_wtime()
     print*, 'matmul lasts ',t2-t1,' seconds'

     !$omp end parallel

     !$omp parallel workshare reduction(+:d) num_threads(2)
     d(1:l)=d(1:l)+c(1:l,1)*b(1,1:l)
     !$omp end parallel workshare
     write(*,'(5e13.6)') (d(i),i=5,25,5)
     stop
     end