Microtasking: Critical Section
code block between CRITICAL and END CRITICAL is executed only by one task at a time
example: reduction ( s = s + a(:) )
subroutine parsum(a,n,sum)
real a(n)
sum=0.0
sumlocal = 0.0
*pdir pardo for, nobarr=(exit)
do i = 1, n
sumlocal = sumlocal + a(i)
end do
*pdir critical
sum = sum + sumlocal
*pdir end critical
return
end
Vorherige Folie
Nächste Folie
Zurück zur ersten Folie
Graphik-Version anzeigen