12.07.2015 Views

The Hierarchically Tiled Arrays Programming Approach

The Hierarchically Tiled Arrays Programming Approach

The Hierarchically Tiled Arrays Programming Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UserMATLAB MATLAB Figure 10: HTA implementation in MATLAB TMcommunications are done through MPI; the lower layersof the HTA toolbox take care of the communication requirements,while the higher layers implement the syntaxexpected by MATLAB TM users.HTA programs have a single thread that is interpretedand executed by the MATLAB TM ’s client. <strong>The</strong> HTAsare just objects within the environment of the interpreter,that when referenced generate calls to the methods of theirclass. When an HTA is local, that is, when it is not distributedon the array of servers, the client HTA keeps boththe structure and the content of the HTA. When it is distributed,the HTA in the client holds the structure of theHTA at all its levels, although it does not contain its content.It also keeps the information of the mapping of thetop level tiles of the HTA on the mesh of servers. In thisway, for any operation, regardless whether the HTA is localor distributed, the client is able to locally:• test the legality of the operation• calculate the structure and mapping of the outputHTA(s)• send the messages that encode the command and itsarguments to the servers.Usually the legality check involves no communication, andthe client is able to generate locally the output HTAs ofthe distributed operations. An advantage of this approachis once the client broadcasts the commands, it is free tocontinue and execute the next statement/operation. Onthe other hand, doing all checking in the client creates abottleneck in the client, thus serializing part of the execution.A source of inefficiency in our current implementation isthat the client uses point to point communication ratherthan broadcasting. This was done so that servers wouldknow that every message a server receives corresponds toan operation in which it participates. This saves the teststhat would be required if the messages were broadcasted.This strategy reduced the development time for the toolbox,but it is slower than using the broadcast, particularlyas the number of servers increases.<strong>The</strong> servers have the structure and data of the top levelHTA tiles that are mapped to them, but they also knowthe structure of the HTAs that are not mapped to them.So, when a HTA is not mapped to a server, the serverknows the number of dimensions of the HTA, the numberof tiles per dimension at the top level, and the size of eachtop level tile in each dimension in terms of elements, as wellas which servers owns each tile. In practice, this allows theservers very often to calculate which server(s) must be thedestination or the source of their messages when they needto exchange data.4.2 MATLAB TM Specific Implementation IssuesA difficulty we found is the lack of destructor in the MATLAB TMclasses. This hindered our ability to destroy distributedHTAs because the HTA subsystem is not notified when anHTA instance is destroyed by the MATLAB TM .Our solution to this problem is to apply a garbage collectionmechanism based on a pattern of changes that wehave detected in the internal structure of an HTA whenMATLAB TM destroys it. Whenever a distributed HTAis built, a record of its internal structure is created inthe client. <strong>The</strong> constructor checks for changes in otherdistributed HTA structures. If any changes are detected,we know that the corresponding HTA has been destroyedand we ask the servers to destroy their components of thedeleted HTAs.Our implementation follows the copy-on-write behavior ofMATLAB TM . In a MATLAB TM assignment, the RHS isnot actually copied, but rather a reference is created fromthe LHS of the assignment to the old value. A copy isonly made when the user attempts to modify the data referredto. Since our HTAs are implemented with the samevariables that MATLAB TM uses, an HTA can have multiplereferences to it. Private copies of distributed HTAsare made only when they have several handles/names inthe program and some of them modify the contents of theHTA.5. EVALUATION5.1 Environmental Setup

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!