next up previous contents index
Next: K. Extrinsic Procedures Up: ADAPTOR HPF Language Reference Previous: I. Data Parallelism   Contents   Index

Subsections

J. Task Parallelism


J..1 The TASK_REGION Construct

The TASK_REGION construct allows the user to specify that disjoint processor subsets can execute blocks of code concurrently.

        real, dimension (N,N) :: A1, A2

!hpf$   processors PROCS(4)
!hpf$   distribute A1 (*,block) onto PROCS(1:2)
!hpf$   distribute A2 (*,block) onto PROCS(3:4)

        ! define a task region, otherwise home will be ignored

!hpf$   task_region
!hpf$     on home (A1), resident
            call TASK1 (A1,N)
!hpf$     on home (A2), resident
            call TASK2 (A2,N)
!hpf$   end task_region

The task region has some advantages:

The data parallel tasks TASK1 and TASK2 will be executed independently on different processor subsets.

At this time, ADAPTOR provides no mechanism to map scalar data to a processor subset. Therefore it should be avoided to pass scalar data to a task that will be modified.

J..2 Data Parallel Pipelines

If there are data dependences between the tasks of a task region, these dependences are observed and will lead to a serial execution. Nevertheless, it can be used to realize a pipeline between data parallel tasks if the task region is executed within a loop.

!hpf$   processors PROCS(P)
        real, dimension(N,N) :: A1,A2
!hpf$   distribute A1 (*,block) onto PROCS (1:P1)
!hpf$   distribute A2 (block,*) onto PROCS (P1+1:P)
        ...
        do I = 1, 10
!hpf$   task_region
!hpf$     on home (A1), resident
            call TASK1 (A1, N)
          A2 = A1
!hpf$     on home (A2), resident
            call TASK2 (A2, N)
!hpf$   end task_region
        end do


J..3 The HPF_TASK_LIBRARY

Communication between different data parallel tasks might be possible if there are no dependences between the different tasks and the tasks are executed on disjoint processor subsets. The tasks get automatically a task identifier starting with 1.

!hpf$ independent task_region
!hpf$ on (PROCS(1))                        ! will be task 1
         call STAGE1 ()
!hpf$ on (PROCS(2:3))                      ! will be task 2
         call STAGE2 (2)
!hpf$ on (PROCS(4:5))                      ! will be task 3
         call STAGE2 (3)
!hpf$ on (PROCS(6))                        ! will be task 4
         call STAGE3 ()
!hpf$ end task_region

Within a data parallel task, the HPF_TASK_LIBRARY can be used to communicate between different tasks.

     subroutine STAGE1 ()
     use HPF_TASK_LIBRARY
     ...
     end subroutine STAGE1


next up previous contents index
Next: K. Extrinsic Procedures Up: ADAPTOR HPF Language Reference Previous: I. Data Parallelism   Contents   Index
Thomas Brandes 2004-03-18