org.javaseis.parallel
Interface IParallelContext

All Known Implementing Classes:
MPIContext, MPIContextWorld, UniprocessorContext

public interface IParallelContext


Method Summary
 void barrier()
          Parallel barrier that requires all tasks to particpate.
<T> void
bcast(int type, T buf, int offset, int count, int sender)
          Broadcast a message to all tasks in this parallel context
 void bcastByte(int type, byte[] buf, int offset, int count, int sender)
           
 void bcastDouble(int type, double[] buf, int offset, int count, int sender)
           
 void bcastFloat(int type, float[] buf, int offset, int count, int sender)
           
 void bcastInt(int type, int[] buf, int offset, int count, int sender)
           
 void bcastLong(int type, long[] buf, int offset, int count, int sender)
           
 void bcastShort(int type, short[] buf, int offset, int count, int sender)
           
<T> void
collect(T a, int aoffset, T b, int boffset, int count)
          Collect an array from all tasks and concatenate on the master task
 byte[] collectByte(byte a)
          Collect a scalar from all tasks into an array and return to all
 void collectByte(byte[] a, int aoffset, byte[] b, int boffset, int count)
           
 double[] collectDouble(double a)
           
 void collectDouble(double[] a, int aoffset, double[] b, int boffset, int count)
           
 float[] collectFloat(float a)
           
 void collectFloat(float[] a, int aoffset, float[] b, int boffset, int count)
           
 int[] collectInt(int a)
           
 void collectInt(int[] a, int aoffset, int[] b, int boffset, int count)
           
 long[] collectLong(long a)
           
 void collectLong(long[] a, int aoffset, long[] b, int boffset, int count)
           
 short[] collectShort(short a)
           
 void collectShort(short[] a, int aoffset, short[] b, int boffset, int count)
           
 void finish()
          Complete participation in the parallel context
<T> void
globalMax(T a, int aoffset, T b, int boffset, int count)
           
 void globalMaxByte(byte[] a, int aoffset, byte[] b, int boffset, int count)
           
 void globalMaxDouble(double[] a, int aoffset, double[] b, int boffset, int count)
           
 void globalMaxFloat(float[] a, int aoffset, float[] b, int boffset, int count)
           
 void globalMaxInt(int[] a, int aoffset, int[] b, int boffset, int count)
           
 void globalMaxLong(long[] a, int aoffset, long[] b, int boffset, int count)
           
 void globalMaxShort(short[] a, int aoffset, short[] b, int boffset, int count)
           
<T> void
globalMin(T a, int aoffset, T b, int boffset, int count)
           
 void globalMinByte(byte[] a, int aoffset, byte[] b, int boffset, int count)
           
 void globalMinDouble(double[] a, int aoffset, double[] b, int boffset, int count)
           
 void globalMinFloat(float[] a, int aoffset, float[] b, int boffset, int count)
           
 void globalMinInt(int[] a, int aoffset, int[] b, int boffset, int count)
           
 void globalMinLong(long[] a, int aoffset, long[] b, int boffset, int count)
           
 void globalMinShort(short[] a, int aoffset, short[] b, int boffset, int count)
           
<T> void
globalSum(T a, int aoffset, T b, int boffset, int count)
          Global operations across tasks in a ParallelContext Operations are provided for Sum, Min, and Max.
 void globalSumByte(byte[] a, int aoffset, byte[] b, int boffset, int count)
           
 void globalSumDouble(double[] a, int aoffset, double[] b, int boffset, int count)
           
 void globalSumFloat(float[] a, int aoffset, float[] b, int boffset, int count)
           
 void globalSumInt(int[] a, int aoffset, int[] b, int boffset, int count)
           
 void globalSumLong(long[] a, int aoffset, long[] b, int boffset, int count)
           
 void globalSumShort(short[] a, int aoffset, short[] b, int boffset, int count)
           
 boolean init(java.lang.String[] args)
          Return true if this is the "master" task for master/slave style algorithms
 boolean isMaster()
          Initialize the parallel context using mpiJava
 void masterPrint(java.lang.String s)
          Print a string from the rank 0 task only A barrier is invoked, so all tasks must participate in the call to this method.
 int rank()
          Return the rank (task index) of this task in the parallel context
<T> void
recv(int tag, T buf, int offset, int count)
          Receive a message from another task in this parallel context
 void recvByte(int tag, byte[] buf, int offset, int count)
           
 void recvDouble(int tag, double[] buf, int offset, int count)
           
 void recvFloat(int tag, float[] buf, int offset, int count)
           
 void recvInt(int tag, int[] buf, int offset, int count)
           
 void recvLong(int tag, long[] buf, int offset, int count)
           
 void recvShort(int tag, short[] buf, int offset, int count)
           
<T> void
send(int tag, T buf, int offset, int count, int dest)
          Send a message to another task in this parallel context
 void sendByte(int tag, byte[] buf, int offset, int count, int dest)
           
 void sendDouble(int tag, double[] buf, int offset, int count, int dest)
           
 void sendFloat(int tag, float[] buf, int offset, int count, int dest)
           
 void sendInt(int tag, int[] buf, int offset, int count, int dest)
           
 void sendLong(int tag, long[] buf, int offset, int count, int dest)
           
 void sendShort(int tag, short[] buf, int offset, int count, int dest)
           
 void serialPrint(java.lang.String s)
          Serialize printing a string from all tasks, so that one line at a time is printed A barrier is invoked, so all tasks must participate in the call to this method.
<T> void
shift(int nshift, T a, int offset, int count, T buf)
          Shift an array of primitive or objects types across tasks in a parallel context
 void shiftByte(int nshift, byte[] a, int offset, int count, byte[] buf)
           
 void shiftDouble(int nshift, double[] a, int offset, int count, double[] buf)
           
 void shiftFloat(int nshift, float[] a, int offset, int count, float[] buf)
           
 void shiftInt(int nshift, int[] a, int offset, int count, int[] buf)
           
 void shiftLong(int nshift, long[] a, int offset, int count, long[] buf)
           
 void shiftShort(int nshift, short[] a, int offset, int count, short[] buf)
           
 int size()
          Return the size (total number of tasks) in the parallel context
<T> void
ttran(int tileSize, T a, int startOffset, T buf)
          Transpose a "tiled" array across tasks in this parallel context.
 void ttranByte(int tileSize, byte[] a, int offset, byte[] buf)
           
 void ttranDouble(int tileSize, double[] a, int offset, double[] buf)
           
 void ttranFloat(int tileSize, float[] a, int offset, float[] buf)
           
 void ttranInt(int tileSize, int[] a, int offset, int[] buf)
           
 void ttranLong(int tileSize, long[] a, int offset, long[] buf)
           
 void ttranShort(int tileSize, short[] a, int offset, short[] buf)
           
<T> void
ttranv(int[] lena, int[] aoffset, T[] a, int[] lenb, int[] boffset, T[] b)
           
<T> void
ttranvInit(int[] lena, int[] aoffset, int[] lenb, int[] boffset)
           
 

Method Detail

barrier

void barrier()
Parallel barrier that requires all tasks to particpate. Serves as a synchronization point for parallel codes.

See Also:
barrier()

bcast

<T> void bcast(int type,
               T buf,
               int offset,
               int count,
               int sender)
Broadcast a message to all tasks in this parallel context

Parameters:
tag - unique integer tag for this message
buf - array containing data to be sent
offset - offset into array where broadcast will start
count - count of elements to be sent
sender - rank of the source for this broadcast
See Also:
org.javaseis.parallel.IParallelContext#bcast(int, T, int, int, int)

bcastByte

void bcastByte(int type,
               byte[] buf,
               int offset,
               int count,
               int sender)

bcastDouble

void bcastDouble(int type,
                 double[] buf,
                 int offset,
                 int count,
                 int sender)

bcastFloat

void bcastFloat(int type,
                float[] buf,
                int offset,
                int count,
                int sender)

bcastInt

void bcastInt(int type,
              int[] buf,
              int offset,
              int count,
              int sender)

bcastLong

void bcastLong(int type,
               long[] buf,
               int offset,
               int count,
               int sender)

bcastShort

void bcastShort(int type,
                short[] buf,
                int offset,
                int count,
                int sender)

collect

<T> void collect(T a,
                 int aoffset,
                 T b,
                 int boffset,
                 int count)
Collect an array from all tasks and concatenate on the master task

Parameters:
a - source array
aoffset - offset within source array for the operation
b - result array, length size*count, where size is the context size
boffset - offset in the result array where results are placed
count - number of elements to collect from each task. Output array b will have count*ParallelContext.size() elements on output. Methods support object and primitive types.

collectByte

byte[] collectByte(byte a)
Collect a scalar from all tasks into an array and return to all

Parameters:
a - input scalar
Returns:
array length ParallelContext.size() containing collected scalars

collectByte

void collectByte(byte[] a,
                 int aoffset,
                 byte[] b,
                 int boffset,
                 int count)

collectDouble

double[] collectDouble(double a)

collectDouble

void collectDouble(double[] a,
                   int aoffset,
                   double[] b,
                   int boffset,
                   int count)

collectFloat

float[] collectFloat(float a)

collectFloat

void collectFloat(float[] a,
                  int aoffset,
                  float[] b,
                  int boffset,
                  int count)

collectInt

int[] collectInt(int a)

collectInt

void collectInt(int[] a,
                int aoffset,
                int[] b,
                int boffset,
                int count)

collectLong

long[] collectLong(long a)

collectLong

void collectLong(long[] a,
                 int aoffset,
                 long[] b,
                 int boffset,
                 int count)

collectShort

short[] collectShort(short a)

collectShort

void collectShort(short[] a,
                  int aoffset,
                  short[] b,
                  int boffset,
                  int count)

finish

void finish()
Complete participation in the parallel context

See Also:
finish()

globalMax

<T> void globalMax(T a,
                   int aoffset,
                   T b,
                   int boffset,
                   int count)

globalMaxByte

void globalMaxByte(byte[] a,
                   int aoffset,
                   byte[] b,
                   int boffset,
                   int count)

globalMaxDouble

void globalMaxDouble(double[] a,
                     int aoffset,
                     double[] b,
                     int boffset,
                     int count)

globalMaxFloat

void globalMaxFloat(float[] a,
                    int aoffset,
                    float[] b,
                    int boffset,
                    int count)

globalMaxInt

void globalMaxInt(int[] a,
                  int aoffset,
                  int[] b,
                  int boffset,
                  int count)

globalMaxLong

void globalMaxLong(long[] a,
                   int aoffset,
                   long[] b,
                   int boffset,
                   int count)

globalMaxShort

void globalMaxShort(short[] a,
                    int aoffset,
                    short[] b,
                    int boffset,
                    int count)

globalMin

<T> void globalMin(T a,
                   int aoffset,
                   T b,
                   int boffset,
                   int count)

globalMinByte

void globalMinByte(byte[] a,
                   int aoffset,
                   byte[] b,
                   int boffset,
                   int count)

globalMinDouble

void globalMinDouble(double[] a,
                     int aoffset,
                     double[] b,
                     int boffset,
                     int count)

globalMinFloat

void globalMinFloat(float[] a,
                    int aoffset,
                    float[] b,
                    int boffset,
                    int count)

globalMinInt

void globalMinInt(int[] a,
                  int aoffset,
                  int[] b,
                  int boffset,
                  int count)

globalMinLong

void globalMinLong(long[] a,
                   int aoffset,
                   long[] b,
                   int boffset,
                   int count)

globalMinShort

void globalMinShort(short[] a,
                    int aoffset,
                    short[] b,
                    int boffset,
                    int count)

globalSum

<T> void globalSum(T a,
                   int aoffset,
                   T b,
                   int boffset,
                   int count)
Global operations across tasks in a ParallelContext Operations are provided for Sum, Min, and Max. The input array contains data for the global operation. The output array contains the sum/min/max of the individual elements from all tasks.

Parameters:
aoffset - offset in input array at which to begin the operation
b - output array containing result across tasks
boffset - offset in output array where results will be placed
count - number of elements to operate on

globalSumByte

void globalSumByte(byte[] a,
                   int aoffset,
                   byte[] b,
                   int boffset,
                   int count)

globalSumDouble

void globalSumDouble(double[] a,
                     int aoffset,
                     double[] b,
                     int boffset,
                     int count)

globalSumFloat

void globalSumFloat(float[] a,
                    int aoffset,
                    float[] b,
                    int boffset,
                    int count)

globalSumInt

void globalSumInt(int[] a,
                  int aoffset,
                  int[] b,
                  int boffset,
                  int count)

globalSumLong

void globalSumLong(long[] a,
                   int aoffset,
                   long[] b,
                   int boffset,
                   int count)

globalSumShort

void globalSumShort(short[] a,
                    int aoffset,
                    short[] b,
                    int boffset,
                    int count)

init

boolean init(java.lang.String[] args)
Return true if this is the "master" task for master/slave style algorithms

Returns:
true if this is the "master" task
See Also:
org.javaseis.parallel.IParallelContext#init()

isMaster

boolean isMaster()
Initialize the parallel context using mpiJava

Parameters:
args - command line argument strings
See Also:
org.javaseis.parallel.IParallelContext#init()

masterPrint

void masterPrint(java.lang.String s)
Print a string from the rank 0 task only A barrier is invoked, so all tasks must participate in the call to this method.

Parameters:
s - string to be printed

rank

int rank()
Return the rank (task index) of this task in the parallel context

Returns:
the rank of this task
See Also:
rank()

recv

<T> void recv(int tag,
              T buf,
              int offset,
              int count)
Receive a message from another task in this parallel context

Parameters:
tag - unique integer tag for this message
buf - array to receive data
offset - offset into array where receive will start
count - maximum count of elements to be received
See Also:
org.javaseis.parallel.IParallelContext#recv(int, T, int, int)

recvByte

void recvByte(int tag,
              byte[] buf,
              int offset,
              int count)

recvDouble

void recvDouble(int tag,
                double[] buf,
                int offset,
                int count)

recvFloat

void recvFloat(int tag,
               float[] buf,
               int offset,
               int count)

recvInt

void recvInt(int tag,
             int[] buf,
             int offset,
             int count)

recvLong

void recvLong(int tag,
              long[] buf,
              int offset,
              int count)

recvShort

void recvShort(int tag,
               short[] buf,
               int offset,
               int count)

send

<T> void send(int tag,
              T buf,
              int offset,
              int count,
              int dest)
Send a message to another task in this parallel context

Parameters:
tag - unique integer tag for this message
buf - array containing data to be sent
offset - offset into array where send will start
count - count of elements to be sent
dest - rank of the destination for this message
See Also:
org.javaseis.parallel.IParallelContext#send(int, T, int, int, int)

sendByte

void sendByte(int tag,
              byte[] buf,
              int offset,
              int count,
              int dest)

sendDouble

void sendDouble(int tag,
                double[] buf,
                int offset,
                int count,
                int dest)

sendFloat

void sendFloat(int tag,
               float[] buf,
               int offset,
               int count,
               int dest)

sendInt

void sendInt(int tag,
             int[] buf,
             int offset,
             int count,
             int dest)

sendLong

void sendLong(int tag,
              long[] buf,
              int offset,
              int count,
              int dest)

sendShort

void sendShort(int tag,
               short[] buf,
               int offset,
               int count,
               int dest)

serialPrint

void serialPrint(java.lang.String s)
Serialize printing a string from all tasks, so that one line at a time is printed A barrier is invoked, so all tasks must participate in the call to this method.

Parameters:
s - string to be printed

shift

<T> void shift(int nshift,
               T a,
               int offset,
               int count,
               T buf)
Shift an array of primitive or objects types across tasks in a parallel context

Parameters:
type - MPI data type, i.e. MPI.INT, MPI.OBJECT, etc
a - input array of objects or primitive types to be shifted
offset - offset into array a that the shift will be performed upon
count - number of array elements to shift
buf - a matching array to input array a, at least count elements in length
See Also:
org.javaseis.parallel.IParallelContext#shift(int, T, int, int)

shiftByte

void shiftByte(int nshift,
               byte[] a,
               int offset,
               int count,
               byte[] buf)

shiftDouble

void shiftDouble(int nshift,
                 double[] a,
                 int offset,
                 int count,
                 double[] buf)

shiftFloat

void shiftFloat(int nshift,
                float[] a,
                int offset,
                int count,
                float[] buf)

shiftInt

void shiftInt(int nshift,
              int[] a,
              int offset,
              int count,
              int[] buf)

shiftLong

void shiftLong(int nshift,
               long[] a,
               int offset,
               int count,
               long[] buf)

shiftShort

void shiftShort(int nshift,
                short[] a,
                int offset,
                int count,
                short[] buf)

size

int size()
Return the size (total number of tasks) in the parallel context

Returns:
number of tasks in this parallel context
See Also:
size()

ttran

<T> void ttran(int tileSize,
               T a,
               int startOffset,
               T buf)
Transpose a "tiled" array across tasks in this parallel context. The tiled array is of size "tileSize x size", where "size" is the number of tasks in this parallel context. All tasks have an array of this size, so the full array is "tileSize x size | size". This primitive can be used to construct transposes for multidimensional rectangular arrays. "ttran" operates on objects, ttranPrimitive operates on primitive types. "ttranv" allows for variable length tiles, were tileSize[i] and offset[i] are the length and offset of each tile in the source array

Parameters:
tileSize - size of the tile for the transpose
a - array containing data to be transposed
startOffset - index of start position in array a for transpose
buf - array of matching type of length "tileSize" used as work space

ttranByte

void ttranByte(int tileSize,
               byte[] a,
               int offset,
               byte[] buf)

ttranDouble

void ttranDouble(int tileSize,
                 double[] a,
                 int offset,
                 double[] buf)

ttranFloat

void ttranFloat(int tileSize,
                float[] a,
                int offset,
                float[] buf)

ttranInt

void ttranInt(int tileSize,
              int[] a,
              int offset,
              int[] buf)

ttranLong

void ttranLong(int tileSize,
               long[] a,
               int offset,
               long[] buf)

ttranShort

void ttranShort(int tileSize,
                short[] a,
                int offset,
                short[] buf)

ttranv

<T> void ttranv(int[] lena,
                int[] aoffset,
                T[] a,
                int[] lenb,
                int[] boffset,
                T[] b)

ttranvInit

<T> void ttranvInit(int[] lena,
                    int[] aoffset,
                    int[] lenb,
                    int[] boffset)