Finite Difference Method using Jacobi Iterations for solving a Heat Distribution Problem
This application calculates heat distribution inside a uniform metal plate at time t given initial border and inner temperatures. The metal plate is discretized as a 2D matrix. Each point in the matrix is calculated as an average of the four neighboring points (east, west, north, south).
Source: Parallel Programming: Techniques and Applications Using Networked Workstations and Parallel Computers, by B. Wilkinson & M. Allen
Required .properties files and configuration
The properties for Chord, Squid, Comet, and Jacobi are set in the following files.
Sample Chord.propererties file
#chord.REMOTE_BOOTSTRAP_LIST=(Comma separated list of bootstrap node URIs)
Sample squid.properties file
Sample comet.properties file
The X_DIM, Y_DIM create the matrix domain. The BLOCK_SIZE specifies number of blocks to partition the matrix. The MAX_ITERATIONS, BORDER_VALUE, OTHER_VALUE are initial conditions. COMPUTATION_TYPE can be ASYNC or SYNC.
JacobiStarter.java – application main().
JacobiConstants.java – set local and global convergence values.
DomainSpace.java – The matrix will be created using parameters set in jacobi.properties andJacobiConstants.java. Supplementary matrix manipulation functions are implemented here.
JacobiMaster.java – The application create data based on properties file and partition data into rows-blocks or square blocks. In case of row-blocks, each block is split into three tasks: Inner, North, South.
JacobiMaster will insert tasks into the shared space. TaskIds are assigned sequentially starting from 0. The BlockIds are also assigned sequentially starting from 1. Each block represents a piece of the data for independent computation. There are two tasks types; “A” (Inner) and “Z”(Border). Likewise, the border directions would be “N”, “S”, “E”, “W”. The border tasks are inserted first, and then the inner task is inserted into the space.
JacobiWorker – Each worker process picks up an inner task, then picks up its associated border tasks (borderIn()). After local computation, the worker will put out new tasks (updated borders) into the space. The computation is repeated until local convergence is met. After all inner tasks have been consumed, master will continue iterations until global convergence is met. These convergence thresholds are set inJacobiConstants.java.
JacobiTaskTuple.java – Every “task” is identified using task tuple; a string that identifies a specific task using tasked, blockid and direction. Each tuple also contains data, here it is the associated submatrix.
“”+ block + “” +
“”+ taskType + “” +
“”+ direction + “” + “<“+MWConstants.MasterNetName+”>*” +
JacobiMaster.txt, stored on Master node, will record the total application time, given that the application finished smoothly. JacobiResults.txt, stored on Master node will record either the result at each iteration and/or the final matrix. JacobiWorker.txt, stored on worker nodes will record space access time such as time for ‘In’ and time for ‘Rd’.
Master/Worker Procedure Outline