Custom Work Distribution
C$OMP PARALLEL shared(A,n)
call ddomain1(n,is,ie)
A(:,is:ie) = …
…
C$OMP END PARALLEL
Subroutine ddomain1(N,is,ie)
integer N ! Assume arrays are (1:N)
integer is,ie ! Lower/upper range
nth=omp_get_num_threads()
mid=omp_get_thread_num()
is=(1+floor((mid*N+0.5)/nth))
ie=MIN(n,floor((mid+1)*N+0.5)/nth))
end
Previous slide
Next slide
Back to first slide
View graphic version