atze@ruuinf.UUCP (Drs. A. Dijkstra) (07/11/88)
Some weeks ago i have posted information about the parallel C compiler from Parsec. I got some reactions, of which most of them wanted more specific information. Well, this is the extra information which i am posting at the responsibility and on behalf of Parsec. I hope this will satisfy questions w.r.t. compiler. More info can be obtained at the address mentioned below. -------------------------------- FROM HERE -------------------------------- PARSEC'S PARALLEL PROGRAMMING SYSTEM In the last few weeks, and following a discussion on the availability of parallelized C for transputers, there have been inquiries about the Parallel C compiler from Parsec. In the following, I will describe the most important features of this compiler and the supporting Par.C System, which will be available from the end of this month (July), and which will cost 3900 Dutch Guilders or the equivalent in other currencies. The Par.C System can be purchased in a version which runs on a T414 transputer under Parsytec's MEGATOOL, or all by itself with a loader/server on the host. Also, the Par.C System can be used as a cross-compiler, running on an IBM, or on other host systems. It is possible to obtain source codes to the loader/server, in order to adapt its functioning to the needs of special systems. This makes it possible to embed the developed transputer program into a host program. THE Par.C PARALELL C COMPILER Parsec's Par.C System makes it possible to write parallel programs in an extended version of the C programming language. The extensions are few, but very powerful and easy to use. We have chosen this approach of parallelizing the language, because it enables the compiler to generate faster code, and the extensions can be used in a flexible way. Besides that, the parallel C source is much clearer than standard C using function calls for parallelism and communication, and therefore it is easier to write and understand parallel C programs. The Par.C compiler recognises the full Kernighan and Ritchie standard C language, including the extensions described in "C: a reference manual" by Harbison and Steele. In the near future, Par.C will be upgraded to meet the Draft Proposed ANSI C standard. The extensions related to parallel programming are the following: 1. DATATYPE CHANNEL A channel is a point-to-point connection between two processes, which can only be used for synchronous communication. This means, that both processes must have arrived at the corresponding communication statements before the datatransfer takes place. Both processes are kept waiting until the message has been properly transferred. A channel can be used in both directions and for different messages. The programmer should take care to check on correspondence of the size of the transmitted and received messages on both sides. A channel can be declared and placed: channel ChannelName; /* declaration of channel */ channel *ChannelPointer; /* declaration of pointer */ channel ChannelArray[SIZE]; /* array of channels */ channel *ChannelPointer = 0x80000000; /* initialization */ Communication is done using the assignment operator: ChannelName = VariableName; /* output */ VariableName = ChannelName; /* input */ The variables sent can be constants, or any other available types in C, incuding structures. 2. PAR CONSTRUCT The par construct is used to start up a number of concurrently running processes on the same transputer. The par construct looks like this: par { (compound) statement; ...... (compound) statement; } Each (compound) statement can be any piece of code, including other par constructs, and is started up as a seperate process. The process executing a par construct will await termination of all started up processes, before proceeding execution of the code following the par. In this way, the closing brackets of the par construct function as a synchronisation point, and the results of all started up processes in that par can be used after this point. 3. SELECT CONSTRUCT The most complicated of the extensions to the standard C language in Par.C is the select construct. In short, it is used to wait for the first of a number of specified possible events to occur. The event that triggers the select determines which piece of code will be executed next. The syntax of the select is as follows: select within <time> { alt guard ChannelPointer : code; ............. alt guard ChannelPointer : code; alt timeout : code; } The "within <time>" part is optional, and must be used in combination with the "alt timeout", to exit the select when none of the other events occur within a certain period of time. In each alt(ernative) clause, a replicator can be used to set up a number of guards. Also, it is possible to 'switch' alternatives on and off using a conditional: alt (i=0;i<k;i++) cond Bool[i] guard &ChannelArray[i] : code(i); SUPPORT FOR PARALLELISM IN THE Par.C SYSTEM There is more to parallel programming than just having the opportunity of writing parallel C source code. Parsec's Par.C System also contains everything one needs to actually run the program on a network of transputers. The Par.C Loader/Server, before loading the program into the network, first does a fast analysis of that network, and thereby makes it possible to boot up any transputer network, without having to recompile or relink the program. The information, including the type and processorspeed, the amount of memory etc., is left behind in each transputer for the program to use. In this way, it is possible to have the program adjust it's execution to the network it is running on. MORE INFORMATION: Parsec Developments P.O. Box 782 2300 AT Leiden Netherlands phone: 071-142142 (from abroad: +31.71.142142)