Docsity

Irregular Computation - High Performance Computing Systems | CMSC 714, Study notes of Computer Science

Toggle sidebar
bg1
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
pf3

Partial preview of the text

Download Irregular Computation - High Performance Computing Systems | CMSC 714 and more Study notes Computer Science in PDF only on Docsity!

CMSC 714

Lecture 6

High Performance Fortran (HPF)

Alan Sussman

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 2

Notes

z Programming 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

z Next 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

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 3

HPF Model of Computation

z goal is to generate loosely synchronous program

  • main target was distributed memory machines

z Explicit identification of parallel work

  • forall statement

z Extensions to FORTRAN

  • 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

z Key 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

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 4

HPF Language Concepts

z Virtual 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

z Template

  • a virtual array (no data)
  • used to describe how real array are aligned with each other
  • templates are distributed onto to virtual processors

z Align 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

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 5

Distribution Options

z BLOCK

  • divide data into N (one per VP) contiguous units

z CYCLIC

  • assign data in round robin fashion to each processor

z BLOCK(n)

  • groups of n units of data are assigned to each processor
  • must be at least (array size)/n virtual processors

z CYCLIC(n)

  • n units of contiguous data are assigned round robin
  • CYCLIC is the same as CYCLIC(1)

z Each can be applied separately to each dimension of

a multi-dimensional array

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 6

Computation

z Where should the computation be performed?

z Goals:

  • do the computation near the data
    • non-local data requires communication
  • keep it simple
    • HPF compilers are already complex

z Compromise: “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

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 7

Finding the Data to Use

z Easy Case

  • the location of the data is known at compile time

z Challenging case

  • the location of the data is a known (invertible) function of input parameters such as array size

z Difficult Case (irregular computation)

  • data location is a function of data
  • indirection array used to access data A[index[I],j] = ...

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 8

Challenging Case

z Each processor can identify its data to send/receive

  • use a pre-processing loop to identify the data to move

for each local element I receive_list = global_to_proc(f(I)) send_list = global_to_proc(f -1(I)) send data in send_list and receive data in receive_list for each local rhs element I perform the computation

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 9

Irregular Computation

z Pre-processing step requires data to be sent/received

  • since we might need to access non-local index arrays

z two possible cases

  • Gather: a(I) = b(u(I))
    • pre-processing builds a receive list for each processor
    • send list is known based on data layout
  • Scatter: a(u(I)) = b(I)
    • pre-processing builds a send list for each processor
    • receive list is known based on data layout

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 10

Communication Library

z How is HPF different from PVM/MPI?

  • abstraction based on distributed, but global arrays
    • provides some support for index translation
    • PVM/MPI only has local arrays
  • multicast is in one dimension of an array only
  • shifts and concatenation provided
  • special ops for moving vectors of send/recv lists in the library for the compiler to use - precomp_read - postcomp_write

z Goals

  • written in terms of native message passing
  • tries to provide a single portable abstraction to compile to

CMSC 714, Fall05 - Alan Sussman & Jeffrey K. Hollingsworth 11

Performance Results

z How good are the speedup results?

  • only one application shown
  • speedup is similar to hand tuned message passing program
    • one extra log(n) communication operations decreases performance
  • how good is the hand tuned program?
    • speedup is only 6 on 16 processors

z What is Figure 4 showing?

  • compares performance on two different machines
  • no explanation
    • is this showing the brand x is better then brand y?
    • does it show that their compiler doesn’t work on brand y?
  • lesson: figures should always tell a story
    • don’t require the reader to guess the story

HPF on the Earth Simulator