
1
CMSC 714
Lecture 6
High Performance Fortran (HPF)
Alan Sussman
2
CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth
Notes
zProgramming assignment
– First part (sequential and either MPI or OpenMP) due next
Thursday, Oct. 6
– You should have received email with which parallel version
to do – if not, send email to Dr. Sussman
zNext class
– Dr. Sussman will finish talking about Titanium, and take
questions on Titanium and OpenMP vs. MPI
– Nick Rutar will talk about the functional programming
language Sisal
3
CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth
HPF Model of Computation
zgoal is to generate loosely synchronous program
– main target was distributed memory machines
zExplicit identification of parallel work
– forall statement
zExtensions to FORTRAN90
– the forall statement has been added to the language
– the rest of the HPF features are comments/pragmas
• any HPF program can be compiled serially
zKey Feature: Data Distribution
– how should data be allocated to nodes?
– critical questions for distributed memory machines
– turns out to be useful for SMP too since it defines locality
4
CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth
HPF Language Concepts
zVirtual processor
– an abstraction of a CPU
– can have one and two dimensional arrays of VPs
– each VP may map to a physical processor
• several VP’s may map to the same processor
zTemplate
– a virtual array (no data)
– used to describe how real array are aligned with each other
– templates are distributed onto to virtual processors
zAlign directives
– expresses how data different arrays should be aligned
– uses affine functions of array indexes
• align element I of array A with element I+3 of B
5
CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth
Distribution Options
zBLOCK
– divide data into N (one per VP) contiguous units
zCYCLIC
– assign data in round robin fashion to each processor
zBLOCK(n)
– groups of n units of data are assigned to each processor
– must be at least (array size)/n virtual processors
zCYCLIC(n)
– n units of contiguous data are assigned round robin
– CYCLIC is the same as CYCLIC(1)
zEach can be applied separately to each dimension of
a multi-dimensional array
6
CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth
Computation
zWhere should the computation be performed?
zGoals:
– do the computation near the data
• non-local data requires communication
– keep it simple
• HPF compilers are already complex
zCompromise: “owner computes”
– computation is done on the node that contains the lhs of a
statement
– non-local data for the rhs operands are sent to the node as
needed, often before a forall loop starts