#### 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.ID_BITS=48

chord.LOCAL_URI=//darkwing.rutgers.edu

#chord.LOCAL_CLUSTER=test

chord.LOCAL_BOOTSTRAP=//darkwing.rutgers.edu:4445

#chord.REMOTE_BOOTSTRAP_LIST=(Comma separated list of bootstrap node URIs)

#chord.STABILIZE_PERIOD=0

#chord.FIX_FINGERS_PERIOD=0

chord.RETRY_PERIOD=30000

chord.RETRY_LIMIT=1

#chord.NETWORK_CLASS=RUDP

chord.DEBUG=comet

#### Sample squid.properties file

squid.SPACE_DIMENSIONS=3

squid.BIT_LENGTH=16

squid.D0.KEY_TYPE=NUMERIC

squid.D1.KEY_TYPE=ALPHABETIC

squid.D2.KEY_TYPE=ALPHABETIC

#### Sample comet.properties file

CometPort=4445

MasterID=101

WorkerNum=1

WorkerId=1

WorkerNumPerPeer=1

HostFileName=NodeInfo

#### Sample jacobi.properties

X_DIM=100

Y_DIM=100

BLOCK_SIZE=25

MAX_ITERATIONS=10

BORDER_VALUE= 100

OTHER_VALUE=0

COMPUTATION_TYPE=ASYNC

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.

#### Implementation

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+”>*” +