2
ELSEVIER Nuclear Instruments and Methods in Physics Research A 389 (1997) 63-64 NUCLEAR INSTRUMENTS a unmoor IN PHVSICS RESEARCM Section A Mixed language parallel programming using ALWAN Robert Frank* Institut ftir Informatik, Mittlere Strasse 142, 4056 Basel. Switzerland Abstract We introduce the coordination language ALWAN and its programming environment which is characterised by properties such as high-level language abstraction, mixed language support, reuse of software, portability, and transpar- ent multiprocessing. Furthermore, we outline the interfacing to C and Fortran. ALWAN has been implemented on several unix platforms as well as on machines such as: APlOO, Cray T3D, Convex Exemplar, Intel Paragon. and IBM SP?. 1. Introduction New paradigms and especially new programming lan- guages are approached with great scepsis by the user community. It is thus essential to integrate anything new into the existing environment, or, in the reverse case, to integrate the existing environment into any new concept. Although ALWAN is a programming language similar to MODULA-2. it is intended to be used to describe the distribution of data amongst processes and the coordina- tion of parallel processes. The actual computations are calls to external routines or libraries. Only a few concepts have been added to reflect the necessities of parallel programming (for details cf. [l-3]): Process topologies are the core of ALWAN programs. A topology is an entity consisting of a data and a state- ment section. An inherit mechanism allows using topol- ogy templates which describe the logical arrangement of processes and their interprocess communication paths for a given process topology. Communication is explicit and is donated by assign- ments. The assignment statement in combination with the @location construct added either on the left or right side indicates a communication. All participating pro- cesses synchronise during a communication. Datu distribution is described by partitioning amd mapping constructs. Indices of (possibly dynamic) arrays * E-mail: [email protected]. This research work has been supported by the Swiss Nation- al Science Foundation (SPP IF 5003-034357, SPP ICS 5003- 45361) and the Swiss Federal Office of Education and Science (ESPRIT HPCN project 21028). can be split in various manners. ALWAN supports both a local view and a global view of distributed data. A typical ALWAN coordination skeleton consists of a declaration block defining the layout of the data and the interfaces to the external routines, one or more paral- lel procedures (“topologies”), and a block containing the code for the controlling process. Variables can be shared with the external code by exporting them (designated by a trailing ‘!’ or ‘*‘). MODULE foreign; TYPE DType(x,y,p:LONGINT)! = ARRAY [O..x - 11, [O..y - l] OF REAL PARTITIONED AS BLOCK(x CDIV p). BLOCK (y CDIV p); VAR controller! : ARRAY [0..9],[0..99] OF REAL; global : INTEGER; distributed : DType; PROCEDURE calc(VAR A: PART OF DType): EXTERNAL; TOPOLOGY demo(x,y:LONGINT); VAR parallel!: INTEGER; BEGIN (* parallel procedure/TOPOLOGY *) distributed[O] : = distributed[parallel]@north; (* copy from north *) .._ calc(distributed); END demo; BEGIN (* controller code *) END foreign. 2. Interfacing to C Interfacing to C is straightforward [ 11, as ALWAN and C both use the same naming and indexing conventions, 016X-9002/97/$17.00 Copyright cl 1997 Elsevier Science B.V. All rights reserved PII SO1 6X-9002(97)00042-9 IIb. PARALLEL COMPUTING

Mixed language parallel programming using ALWAN

Embed Size (px)

Citation preview

ELSEVIER

Nuclear Instruments and Methods in Physics Research A 389 (1997) 63-64 NUCLEAR

INSTRUMENTS a unmoor IN PHVSICS RESEARCM

Section A

Mixed language parallel programming using ALWAN

Robert Frank*

Institut ftir Informatik, Mittlere Strasse 142, 4056 Basel. Switzerland

Abstract We introduce the coordination language ALWAN and its programming environment which is characterised by

properties such as high-level language abstraction, mixed language support, reuse of software, portability, and transpar- ent multiprocessing. Furthermore, we outline the interfacing to C and Fortran. ALWAN has been implemented on several unix platforms as well as on machines such as: APlOO, Cray T3D, Convex Exemplar, Intel Paragon. and IBM SP?.

1. Introduction

New paradigms and especially new programming lan-

guages are approached with great scepsis by the user community. It is thus essential to integrate anything new into the existing environment, or, in the reverse case, to integrate the existing environment into any new concept. Although ALWAN is a programming language similar to MODULA-2. it is intended to be used to describe the distribution of data amongst processes and the coordina- tion of parallel processes. The actual computations are calls to external routines or libraries. Only a few concepts have been added to reflect the necessities of parallel programming (for details cf. [l-3]):

Process topologies are the core of ALWAN programs.

A topology is an entity consisting of a data and a state- ment section. An inherit mechanism allows using topol- ogy templates which describe the logical arrangement of processes and their interprocess communication paths

for a given process topology. Communication is explicit and is donated by assign-

ments. The assignment statement in combination with the @location construct added either on the left or right side indicates a communication. All participating pro- cesses synchronise during a communication.

Datu distribution is described by partitioning amd mapping constructs. Indices of (possibly dynamic) arrays

* E-mail: [email protected]. ’ This research work has been supported by the Swiss Nation-

al Science Foundation (SPP IF 5003-034357, SPP ICS 5003- 45361) and the Swiss Federal Office of Education and Science

(ESPRIT HPCN project 21028).

can be split in various manners. ALWAN supports both a local view and a global view of distributed data.

A typical ALWAN coordination skeleton consists of a declaration block defining the layout of the data and the interfaces to the external routines, one or more paral- lel procedures (“topologies”), and a block containing the code for the controlling process. Variables can be shared with the external code by exporting them (designated by a trailing ‘!’ or ‘*‘).

MODULE foreign; TYPE DType(x,y,p:LONGINT)! =

ARRAY [O..x - 11, [O..y - l] OF REAL PARTITIONED AS

BLOCK(x CDIV p). BLOCK (y CDIV p);

VAR controller! : ARRAY [0..9],[0..99] OF REAL; global : INTEGER; distributed : DType;

PROCEDURE calc(VAR A: PART OF DType): EXTERNAL;

TOPOLOGY demo(x,y:LONGINT); VAR parallel!: INTEGER; BEGIN (* parallel procedure/TOPOLOGY *)

distributed[O] : = distributed[parallel]@north; (* copy from north *) .._

calc(distributed); END demo;

BEGIN (* controller code *) END foreign.

2. Interfacing to C

Interfacing to C is straightforward [ 11, as ALWAN and C both use the same naming and indexing conventions,

016X-9002/97/$17.00 Copyright cl 1997 Elsevier Science B.V. All rights reserved PII SO1 6X-9002(97)00042-9 IIb. PARALLEL COMPUTING

64 R. FranklNucl. Insir. and Meth. in Phts. Res. A 389 (1997) 63-64

and as the ALWAN compiler generates C code. Multi- ALWAN always generates extra information for dy-

dimensional dynamic arrays can be passed in two ways namic or distributed arrays which can be used to fully

(determined by a compiler directive): define the procedure local arrays.

as a pointer to a block of memory, which means that, for multidimensional arrays, the index has to be explicitly calculated, 4. Status of implementation

as a series of pointers to pointers, which allows normal C array indexing in all dimensions.

ALWAN can generate extra information for each index

of an array, which can be used to determine the bounds of a dynamic array.

3. Interfacing to FORTRAN

ALWAN is being used in diverse software projects, such as: performance prediction, visualization of brain-

scan data, CFD, and client-server computing. ALWAN is available for several unix workstations as well as:

APlOO (MPI), Cray T3D (PVM). Convex Exemplar (MPI, PVM, and VSM), Intel Paragon (MPI, NX, and PVM), and IBM SP2 (MPI and PVM). ALWAN is public domain!

Interfacing to FORTRAN is not straightforward as the languages differ in several ways. One must decide

whether to interface to FORTRAN 77 or to Fortran 90. FORTRAN 77 cannot reference records or arrays of records exported from ALWAN, does not allow under- scores in variable names (ALWAN does), and identifiers are only six characters long. However, most compilers accept both underscores and longer identifier names.

References

[I] H. Burkhart, R. Frank and G. Hichler. ALWAN Progran- mer’s Manual. http://www.ili.unibas.ch/grubu/alwan: alwan.html.

ALWAN generates a template FORTRAN file defin- ing the common blocks as well as the headers of all FORTRAN external routines. Exported controller varia- bles are available in the named common section with the name of the ALWAN module. Exported parallel vari- ables are available in the named common section with the name of the exporting parallel procedure. ALWAN will generate the declarations of all variables and will automatically reverse the indexes of all arrays.

[2] G. Hichler and H. Burkhart. Implementing the ALWAN Communication and Data Distribution Library Using PVM. in: Lecture Notes In Computer Science, Parallel Virtual Machine, Proc. EuroPVM’96 (3rd European PVM Conf., Munich) (Springer, Berlin. 1996).

[3] H. Burkhart. R. Frank and G. H&hler, Structured Parallel Programming: How Informatics Can Help Overcome the Software Dilemma. in: Lecure Notes in Computer Science 1061, Coordination Languages and Models, Proc. CO- ORDINATION ‘96 (1st Int. Conf. COORDINATION ‘96, Cesena, Italy) (Springer, Berlin. 1996).