This section describes the different execution models of High Performance Fortran. Though the description is related to the ADAPTOR compilation system, most of the techniques might also be applied within other HPF compilers. This is especially true for the distributed memory execution model based on message passing.
The HPF mapping directives define a mapping of data objects (arrays) to abstract processors. Data objects that have been mapped to a certain abstract processor are said to be owned by that processor. Ownership of data is the central concept for the execution of HPF programs. Based on the ownership of data, the distribution of computations to the abstract processors and the necessary communication and/or synchronization between processors is derived automatically.
While the concept of ownership and work distribution is followed within all HPF execution models, the layout of distributed data and the mapping of abstract processors to processes or threads varies for the different HPF execution models.
HPF programs can also run as serial programs. For this purpose, ADAPTOR treats them as follows:
forall (I=2:N-1) A(I) = f(A(I-1),A(I+1))is translated to
allocate (TMP(2:N-1)) do I = 2, N-1 TMP(I) = f(A(I-1),A(I+1)) end do do I = 2, N-1 A(I) = TMP(I) end do deallocate (TMP)
In the multiprocessing execution model, every abstract HPF processor becomes an own process with its own local address space. Each process executes the same program but operates only on its own data. Any two processes communicate by exchanging messages. In accordance with the SPMD paradigm, an HPF compiler has to ensure that all processes executing the target program follow the same control flow in a loosely synchronous style. For the parallel execution, each process is usually mapped to one processor.
The multi-processing execution model for HPF, illustrated in Figure 2, has the following main characteristics:
The multi-threading execution model for HPF, targeted towards shared memory parallel architectures only, is fundamentally different from the multi-processing execution model. With the multi-threading execution model, a HPF program is compiled into a shared memory parallel program which utilizes thread parallelism only.
The multithreading execution model employs a set of threads which execute concurrently in a shared address space. All data objects of an HPF program are allocated in an un-partitioned way in the shared memory, regardless of HPF mapping directives. The information provided by the HPF mapping directives is utilized the achieve parallel execution by distributing the computations among the threads. Consistency of shared data objects is guaranteed by automatically generating the required synchronization between threads.
The multi-threading execution model for HPF has the following main characteristics [BB00]:
REDUCTION and NEW clauses are handled similar to the REDUCTION and PRIVATE clauses of OpenMP.
!hpf$ independent, new(X), reduction(SUM) do I = 1, N X = W * (I -0.5d0) SUM = SUM + F(X) end do
is translated to
!omp$ parallel do, private(X), reduction(+:SUM) do I = 1, N X = W * (I -0.5d0) SUM = SUM + F(X) end do
The use of this thread based shared memory programming model for HPF can be very convenient for porting applications to HPF. In this model, data locality does not play such an important rule and there are no problems for the HPF compiler to generate efficient communication.
Within the hierarchical execution model an HPF program is executed by a set of parallel processes, each of which executes on a separate node of an SMP cluster within its own local address space. Each of these processes employs of a set of threads which execute concurrently in the shared address space of a node. Process parallelism, data partitioning, and message-passing communication is utilized between the nodes of a cluster in much the same way as in the multiprocessing execution model, while within a node additional parallelism is exploited in analogy to the multi-threading execution model by means of threads concurrently executing in a shared address space.
The hierarchical execution model, illustrated in Figure 4 has the following main characteristics:
The hierarchical execution model offers certain advantages against the multiprocessing execution model.