shpcc94 (Раздаточные материалы)
Описание файла
Файл "shpcc94" внутри архива находится в следующих папках: Раздаточные материалы, SAGE. PDF-файл из архива "Раздаточные материалы", который расположен в категории "". Всё это находится в предмете "модели параллельных вычислений и dvm технология разработки параллельных программ" из 7 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .
Просмотр PDF-файла онлайн
Текст из PDF
High Performance Fortran Interface to the Parallel C++ Shelby X. Yang, Dennis Gannon, Suresh Srinivas, Francois Bodin, and Paul BodeDepartment of Computer Science, Indiana UniversityBloomington, IN 47405fyang,gannon,ssriniva,fbodin,bodeg@rainier.cica.indiana.eduAbstractThis paper describes the design of a Fortran interface to the parallel C++ (pC++) programming language. The pC++ Fortran interface provides a mechanism for users to link pC++ programs with Fortransubroutines so that they can take advantage of both thefast computing speed of Fortran and the object-orientedprogramming paradigm of C++. We will discuss thedesign of the Fortran interface and illustrate it witha galactic dynamics application.
Our interface implementation is ecient. The galactic dynamics application can achieve a 14.4 Gops sustained speed on a512-node CM-5 massively parallel supercomputer.1 IntroductionOne of the principal roles played by C++ in programming massively parallel computers is in the design of distributed data structures that are either toocomplex or simply inconvenient to program in Fortran. However, the mainstay of scientic and engineering programming is Fortran. The reasons for thisare more than cultural. The restrictions in the Fortran type-system prohibit the use of pointers beyondthe simple alias mechanisms allowed by Fortran90.Consequently, Fortran compilers can perform aggressive data-dependence-based optimizations which arenot possible in C++. In addition, code generationtechnology and optimized intrinsic library functionspresent in Fortran are much better than their C++counterparts.
With the present generation of Fortran90 compilers, vector and array operations will beeasy to compile into ecient code. We believe thatit is essential to support a portable programming en This research issupported in part by ARPA under contractAF 30602-92-C-0135, the National Science Foundation Oce ofAdvanced Scientic Computing under grant ASC-9111616, andthe National Science Foundation and ARPA Grand ChallengeAward, \The Formation of Galaxies and Large-scale Structure."vironment that mixes Fortran with C++ across theentire range of supercomputing platforms. 1There is no fundamental problem in linking Fortranto C++ programs.
C++ has a standard facility forrepresenting interfaces to other languages. However,with the founding of the High Performance FortranForum and the publication of the High PerformanceFortran (HPF) [1] extensions to Fortran90, we have anew problem. In this paper, we explore and propose amechanism for linking HPF programs to parallel C++programs.The paper is organized as follows. In section 2, wegive a brief introduction to pC++.
In section 3, 4, and5, we discuss the design of the Fortran interface. Insection 6, we discribe our experiments with a galacticdynamics application on the Thinking Machines CM5 and the Intel Paragon. And nally in section 7, wedraw our conclusions.2 A brief introduction to pC++pC++ [2] is an extension of C++ designed to allow programmers to compose \concurrent aggregate"classes which can be aligned and distributed over thememory of a parallel machine in a manner similar tothe HPF compiler directives.
pC++ allows users towrite portable and ecient codes which can be run ona wide range of parallel computer systems. The rstversion of the compiler is a preprocessor which generates Single Program Multiple Data (SPMD) C++code. Currently, it runs on the Thinking MachinesCM-5, the Intel Paragon, the BBN TC2000, theKendall Square Research KSR-1, the IBM SP-1, Parallel Virtual Machine (PVM) for workstation clusters,and the Sequent Symmetry. The basic concept behind1 This point of view is also supported in the researchcommunity. The soon to be published conclusions of the1993 NSF/ARPA/DOE Grand Challenge Meeting include several strong recommendations for more investigation of mixingobject-oriented style with the more traditional programmingstyles.pC++ is the notion of a distributed data structure,called Collection, and parallel operations associatedwith it. A collection is a structured set of objects distributed across the processing elements of a computer.In a manner designed to be consistent with HPF, distribution of the objects in a collection over the processors is dened by programmers.
pC++ provides amechanism for building a \collection of objects" froma base element class. Member functions of this elementclass can be applied to the entire collection (or a subset) in parallel. This type of parallelism is similar todata-parallelism, though we call it object-parallelism.In addition, there is a mechanism for encapsulating theSPMD style in a thread based computing paradigm.A base element class is a normal C++ class. Forexample, a class that represents a segment of a list ofparticles in an N-body simulation can be declared asclass Segment {public:double x[seg_nbodies],y[seg_nbodies],z[seg_nbodies],mass[seg_nbodies];Segment();void AccelerateParticles();}where x, y, and z represent the position of a particle in the x, y, and z dimesions, and mass presentsthe mass of the particle.
The member functionAccelerateParticles accelerates the the particlesaccording to the forces exerted on them.A pC++ collection has the following component:Collection NameOfCollection:ParentCollection{private:<private data fields and functions>protected:<protected data fields and functions>public:<public data fields and functions>MethodOfElement:<data fields and functionsadded to each element>};The key points to note are: A collection declaration begins with the keywordCollection which is followed by the name of thecollection and the name of the base collection thecurrent collection inherits.
A collection has private, protected, public dataelds and member functions exactly as a normalC++ class. However, when a collection object isallocated, one copy of the collection structure isallocated in the memory of each processor. Themember functions in a collection are invoked inthe SPMD mode. A collection also has a set of data elds andmember functions that will be copied into eachbase element class as public elds. These are labeled as MethodOfElement elds.
The purposeof MethodOfElement elds is to allow each element to access or act on other elements in thecollection. They are invoked in the object-parallelmode like other member functions in the base element class.To construct a collection object one needs to create aprocessor object, a distribution object and an alignment object analogous to HPF. pC++ uses a speciallibrary class called Processors for the processor object. In the current implementation, it represents theset of all processors available to the program at runtime.
To build a distribution of some size, say 64, onecan writeProcessors P;Distribution D(64,&P,CYCLIC);where the ith distribution grid is mapped to processori%P, because a cyclic distribution is used. To createan alignment object that denes the mapping of thecollection elements to the distribution one writesAlign A(32,"[ALIGN(T[i],D[i])]");where it is assumed that there are 32 elements in thecollection. The collection constructor uses the alignment object to dene the size and dimension of thecollection. The mapping is described by a text stringcorresponding to the HPF alignment directive.
It denes a mapping from a domain structure to a distribution structure using dummy index variables.The intent of this two stage mapping, as it was originally conceived for HPF, is to allow the distributioncoordinates to be a frame of reference so that dierentarrays could be aligned with each other in a mannerthat promotes memory locality.With the distribution and alignment objects dened, a collection of Segment class can be constructed:NameOFCollection<Segment> C(&D,&A);and member function AccelerateParticles can beinvoked in the object-parallel modeC.AccelerateParticles();3 Interfacing HPF and pC++Let us consider the ways in which this interfacemight operate: HPF calling C++/pC++:a. A direct call to a C++ function from the mainthread of a Fortran program.
This presentsno real problems that did not exist before,unless an HPF distributed array is passed asan argument.b. A C++ function is called as an HPF extrinsicfunction in a parallelized loop. Again this isonly interesting if an HPF distributed arrayis passed as an argument.The HPF extrinsic procedure interface which allows calls to non-HPF subprograms as extrinsicprocedures may well suce for the above two situations provided the C++ subprogram is designedto be executed on a single processor. In bothcases we assume that the C++ function will notattempt to return a value of any type other thana base type like int or double.