An object-based parallel programming assistant

Programmers of sequential and parallel computers share the objective of developing fast, reliable programs as efficiently as possible. Already, considerable effort has been made to develop tools and techniques for sequential computers. Several approaches have been devised to meet the parallel programming challenge. Sequential languages have been adapted for parallel computers; new parallel languages designed; and tools developed which aid the programmer in detecting parallel code. A parallel programming assistant can aid the user in several ways: it can carry out tasks that are simple but mundane to the user, it can make comprehension easier for the user by summarizing program information; and it can cooperate with the user in doing a complex task, thus combining its own knowledge with that of the user's.We have developed a parallel programming assistant [1] which supports object-based programming. The main motivation for this work was to explore how an assistant can enhance the programmer's understanding of parallel programming. In particular, we wanted to provide the user with parallel programming methods which would be easily integrated with other parts of the life cycle. Moreover, we wanted the programmer to interact with the assistant while writing parallel programs.The parallel programming assistant interactively aids the user in developing parallel programs. Instead of automatically detecting implicit parallelism in sequential code and subsequently transforming it, the parallel programming assistant analyzes statements as they are entered and immediately gives the user feedback on whether they hinder parallelization. Moreover, the assistant tells the user if the dependencies in the program which hinder parallelization can be removed by transformation.The parallel programming assistant supports object-based development. In the object-based paradigm, the decomposition of a system is based upon the concept of an object [2]. An object is a “thing” that has the capacity to store information, manipulate its own information, carry out some task upon request from an object, and activate an object. Objects are not only things where we store data, such as a line or a collection of records, but are also more powerful things which represent components in a software system such as a user interface. The first mentioned objects are data objects, the last mentioned are processing objects. The expressive power of an object-based language makes it easier for the parallel programming assistant to gather semantics about the program which it then uses to decide how to form parallel language constructs.There are two programming activities within the assistant: 1) specifying and implementing objects, and 2) writing statements that call the methods of these objects. The user does not have to carry out (or complete) activity 1) before 2) and he can freely go from one to the other. In parallel programming these activities involve: P1) partitioning an object in order to enable parallel execution of methods on the object (methods-partitioning); or partitioning an object to enable parallel execution of methods on objects within the object, (object-partitioning) and P2) writing parallel statements (i.e. parallel loops and parallel blocks).An example of a simple parallel block under construction within the parallel programming assistant is:While the block is under construction, the assistant divides it into regions such that statements in a region can be called in parallel. As statements are entered the configuration of the regions changes. When all statements have been entered, and all information is available, the TentativeParallelBlock is changed to zero or more ParallelBlocks. In the example above, the assistant examines whether the two statements are dependent by method-partitioning the object Line, such that the methods setfrom and setto are in separate partitions. Since the object Line is self-contained the assistant only needs to look for dependencies within the object Line. More complex cases arise when the assistant needs to detect dependencies between statements that call methods on separate processing objects which are not self-contained. In this case the object which contains the called objects has to be object-partitioned.The second language construct which the assistant helps the user creating is a parallel loop:As the programmer enters statements to the loop above, the assistant examines whether the objects hinder parallelization of the loop. The assistant first checks whether the structure of the object hinders partitioning of the object. Then, it checks whether the methods hinder parallelization, and finally whether the iterator of the object hinders its partitioning. When homogeneous objects, such as Lines, are partitioned, each partition gets its own set of methods. Each processor then accesses one of these partitions. In a loop, objects are not only partitioned, but also multiplied. An object such as Line is multiplied so that there are P copies, one for each processor.We specified and designed the parallel programming assistant using the object-based paradigm to software development. The experience we gained in object-based software development was helpful in designing the transformations on the objects for the parallel programming assistant.The interactive nature of the parallel programming assistant gives the user the opportunity to intervene when information is missing, that is when the implementation of objects is incomplete. An object-based language allows us to associates attributes to software objects and their methods. This provides more flexibility in the design of the parallel programming assistant, since the attributes can determine the type of transformations. As more types of objects for parallel programming become known, more transformations can be added to the assistant.