http:^^www.cs.washington.edu^research^projects^zpl^intro^overview.html

来自「This data set contains WWW-pages collect」· HTML 代码 · 共 352 行 · 第 1/2 页

HTML
352
字号
Date: Tue, 10 Dec 1996 03:29:28 GMTServer: NCSA/1.4.2Content-type: text/html<html><head>	<title>ZPL Overview</title></head><body><h1><!WA0><!WA0><!WA0><!WA0><img align=center src="http://www.cs.washington.edu/research/projects/zpl/images/zpl.logo.gif"> <a name="top">ZPL Overview</a></h1><hr><p>ZPL is a new array programming language designed for engineering andscientific programs that would previously have been written in Fortran.Because its design goals were machine independence and high performance, ZPLprograms run fast on both sequential and parallel computers.  Because it is"implicitly parallel," i.e. the programmer does NOT express the parallelism,ZPL programs are simple and easy to write.</p><p>On this page, ZPL is described at a high level by answering the "obvious"questions about it and its implementation. The page concludes with a ZPL factsheet.</p><hr><p><b>What is an array language?</b> In scalar languages like Fortran, C,Pascal and Ada, operations apply only to single values, so a + b expressesthe addition of two numbers.  In such languages adding two arrays requiresindexing and looping:</p><pre>   DO 10 I = 1, N                     for ( i=0; i&ltn; i++) {      DO 10 J = 1, N		          for ( j=0; j&ltn; j++){10       A(I,J) = A(I,J) + B(I,J)             a[i][j] = a[i][j]+b[i][j];                                          }                                      }            <b>FORTRAN 77</b>                               <b>C</b></pre><p>This need to loop and index to perform operations on arrays is bothtedious and error prone.</p><p>In ZPL operations are generalized to apply to both scalars and arrays.Thus, a + b expresses the sum of two scalars if a and b were declared asscalars, or arrays if they were declared as arrays.  When applied to arrays,the operations act on corresponding elements as illustrated in the loopsabove.  Indeed, when the ZPL compiler encounters the statement<pre>	A := A + B;</pre>and A and B are two dimensional arrays, it generates code that is effectivelythe same as the C loops shown above.  An array language, therefore,simplifies programming.</p><p><b>Why create a new array language?</b> Programming languages are createdall the time in computer science, but the widespread adoption of a newprogramming language is an extremely rare event.  The recent use ofobject-oriented languages shows that it does occur from time-to-time.Nevertheless, the cardinal rule is, "If you want your research to be appliedin practice, do not invent a new language."  It is much better to extend orenhance an existing language that has an established user base.</p><p>Parallelism, in the opinion of ZPL's designers, is a phenomenon thatcannot be fully exploited through the medium of existing programminglanguages, even existing array languages, such as Fortran 90 and APL[Greenlaw90].  Case after case demonstrates that effective parallelcomputations are typically accomplished through a "paradigm shift" away fromsequential solutions.  This shift, which is more frequently discontinuousthan the term "shift" implies, is inhibited by languages designed forsequential computers.</p><p>A new language can avoid these problems and facilitate the paradigmshift.  Further, by choosing its primitives carefully, new research inparallel compilation can apply.  So, ZPL has been designed from firstprinciples (see below) to realize these goals.</p><p><b>Isn't programming with arrays hard?</b> Programmers unfamiliar withthem may find array languages a little different initially, but technicalprogrammers, meaning scientists, engineers, mathematicians, statisticians,etc., will generally find them natural.  Indeed, many science and engineeringproblems are formulated in a way that is perhaps closer to array languagesthan scalar languages.</p><p>As a trivial example, consider the computation of the mean and standarddeviation of a <tt><b>Sample</b></tt> of <tt><b>n</b></tt> items.  Thetextbook definitions of these quantities are: </p><center><!WA1><!WA1><!WA1><!WA1><img src="http://www.cs.washington.edu/research/projects/zpl/intro/equations.gif"></center><p>In ZPL, <tt><b>mu</b></tt> and <tt><b>sigma</b></tt> are computed bysingle statements which mirror the definitions:</p><pre>    mu    := +&lt;&lt;Sample/n;                   -- Mean    sigma := sqrt((+&lt;&lt;sqr(Sample-mu))/n);   -- Std deviation</pre><p>The array <tt><b>Sample</b></tt> contains the items, and the operator+&lt;&lt; sums them.  So <tt><b>m</b></tt> is a direct translation.  The computationis analogous and illustrates several features of ZPL, including subtracting<tt><b>mu</b></tt> from each item of <tt><b>Sample</b></tt>, (this is called<i>promoting</i> a scalar to an array), promoting a scalar function sqr to bean array function by applying it to each item of the array, etc.  Theseproperties of ZPL, e.g. promotion, are simply programming languageterminology for natural concepts technically educated people already know.</p><p>After using ZPL for a few months, a graduate student research assistant incivil engineering rebelled when told to program in C again.</p><p><b>High performance is widely claimed; why believe it for ZPL?</b> Forsome languages "high performance" is part of the name.  For ZPL, "highperformance" is part of the description, as backed by experimental evidence[Dikaiakos,Lewis,Lin95.]This evidence takes different forms, but is always relative to other means ofachieving good performance.  For example, Fortran 77 programs runsequentially, or C programs customized to a parallel platforms (with userspecified communication), are regarded as reasonable ways to establish goodbaselines, since these usually represent the best alternatives to achievinggood performance.</p><p>The evidence of ZPL's high performance derives from several types ofexperiments [Lin94, Lin95], one of which will be mentioned here:  SIMPLE is afluid dynamics program developed at Lawrence Livermore National Laboratoriesto benchmark new computers and compilers.  The computation has been widelyused in the study of parallel computing.  A parallel version of the original2400 line Fortran 77 program was developed by Gannon and Panetta [Gannon86].A high quality, variable grain version written in C requires approximately5000 lines [Lee92].  This C program, customized to the Intel Paragon and theKendal Square Research KSR-2, was compared to the 520 line ZPL program forSIMPLE [Lin94].  The speedups of these programs are shown for experimentsinvolving 10 iterations on a 256 x 256 size problem.</p><center><!WA2><!WA2><!WA2><!WA2><img src="http://www.cs.washington.edu/research/projects/zpl/intro/simple.paragon.su.gif"> <!WA3><!WA3><!WA3><!WA3><img src="http://www.cs.washington.edu/research/projects/zpl/intro/simple.ksr.su.gif"></center><p>The experiments indicate that the high level ZPL performs as well as thelow-level C program for these two machines.  Other information suggests thatsimilar behavior can be expected on any MIMD parallel computer [Lin90].</p><p><b>Why does ZPL have such good performance?</b> ZPL does not have parallel"directives" or other forms of explicit parallelism.  Instead, it exploitsthe fact that when programmers describe computations in terms of arrays, manyscalar operations must be performed to implement the array operations. This"implied" computation can be parceled out to different processors to getconcurrency.  Thus, the parallelism comes simply from the semantics of thearray operations.</p><p><b>What does 'ZPL was designed from first principles' mean?</b> ZPL isactually the dataparallel sublanguage of a more powerful parallel programminglanguage, called Advanced ZPL [Lin94] or A-ZPL.  A-ZPL is a fully generalparallel language for "power" users, i.e. programmers with extremeperformance requirements and the sophistication to use more demandingtechnology.  A-ZPL is not yet implemented, and its completion is not expectedfor at least two years.</p><p>Advanced ZPL (known previously as Orca C) implements a programming model,called Phase Abstractions [Griswold90].  The Phase Abstractions model iscapable of expressing task parallelism, pipelined parallelism and otherparallel programming paradigms, not just data parallelism.  The PhaseAbstractions programming model is built on and generalizes a parallel machinemodel, called the CTA [Snyder86].  The CTA abstracts the family ofmultiple-instruction-multiple-data (MIMD) computers.  The two models are themechanism by which the benefits and costs of parallel computation aresuccinctly conveyed to A-ZPL programmers [Snyder93].  The models balance theconflicting requirements that to write efficient code, the programmer needs

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?