|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javaseis.parallel.Decomposition
public class Decomposition
Define decompositions used to spread multidimensional arrays across tasks in a parallel context. Simple decompositions are used to define the subset of data owned by each task.
A "BLOCK" decomposition allocates a contiguous set of indices to each task. This decomposition is complicated by the need for a fixed number of indices for each task. The parameters that define the decomposition are the number distributed elements, the number of elements per task, and the number of "live" elements for a particular task. This number of live elements is needed since the number of distributed elements may not be a multiple of the number of tasks in the parallel context. For example, consider distributing 13 elements across 4 nodes:
BLOCK Decomposition for 13 elements on 4 nodes taskNumber : 0 1 2 3 elementsPerTask: 4 4 4 4 liveElements : 4 4 4 1 indexRange : 1,4,1 5,8,1 9,12,1 13,13,1The number of elements per task is 4, but the number of elements on the last task is only 1, so remainder logic will be needed to deal with this complication in most codes that utilize a BLOCK decomposition. Also, array lengths will need to be padded to accomodate the maximum number of task elements.
For a "CIRCULAR" decomposition the elements are dealt out like a deck of cards, so in the case described above for 13 elements on 4 tasks we would have:
Circular Decomposition for 13 elements on 4 nodes taskNumber : 0 1 2 3 elementsPerTask: 4 4 4 4 liveElements : 4 3 3 3 indexRange : 1,13,4 2,10,4 3,11,4 4,12,4
Field Summary | |
---|---|
static int |
BLOCK
|
static int |
CIRCULAR
|
static int |
NONE
|
Constructor Summary | |
---|---|
Decomposition(int type,
int numElements,
int numTasks,
int taskNumber)
Set decomposition for an explicit number of tasks and task number |
|
Decomposition(int type,
int numElements,
IParallelContext pc)
Set decomposition for a given parallel context |
|
Decomposition(int type,
long numElements,
int numTasks,
int taskNumber)
Set decomposition for an explicit number of tasks and task number |
|
Decomposition(int type,
long numElements,
IParallelContext pc)
Set decomposition for a given parallel context |
Method Summary | |
---|---|
static int |
elementsPerTask(int numElements,
int numTasks)
Return padded array length for a given number of tasks |
int |
getDecompType()
|
int |
getElementsPerTask()
|
int[] |
getFortranRange()
Return the 1 to N Fortran based index range for this task in the decomposition |
int[] |
getIndexRange()
|
int |
getLiveElements()
|
int |
getOriginalLength()
|
int |
getPaddedLength()
|
static long |
liveElements(long numElements,
int numTasks,
int taskNumber)
|
long |
longElementsPerTask()
|
long[] |
longIndexRange()
|
long |
longLiveElements()
|
long |
longOriginalLength()
|
long |
longPaddedLength()
|
static int |
paddedLength(int numElements,
int numTasks)
Return padded array length for a given number of tasks |
void |
setBlockDecomp(long numElements,
int numTasks,
int taskNumber)
|
void |
setCircularDecomp(long numElements,
int numTasks,
int taskNumber)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int BLOCK
public static int CIRCULAR
public static int NONE
Constructor Detail |
---|
public Decomposition(int type, int numElements, int numTasks, int taskNumber)
type
- decomposition type, BLOCK or CIRCULARnumElements
- number of elements to decomposenumTasks
- number of tasks in the parallel contexttaskNumber
- task number within the parallel context for the decompositionpublic Decomposition(int type, int numElements, IParallelContext pc)
type
- decomposition type, BLOCK or CIRCULARnumElements
- number of elements to decomposepc
- parallel context for the decompositionpublic Decomposition(int type, long numElements, int numTasks, int taskNumber)
type
- decomposition type, BLOCK or CIRCULARnumElements
- number of elements to decomposenumTasks
- number of tasks in the parallel contexttaskNumber
- task number within the parallel context for the decompositionpublic Decomposition(int type, long numElements, IParallelContext pc)
type
- decomposition type, BLOCK or CIRCULARnumElements
- number of elements to decomposepc
- parallel context for the decompositionMethod Detail |
---|
public static int elementsPerTask(int numElements, int numTasks)
length
- input lengthnumTasks
- number of tasks for the parallel decomposition
public int getDecompType()
public int getElementsPerTask()
public int[] getFortranRange()
public int[] getIndexRange()
public int getLiveElements()
public int getOriginalLength()
public int getPaddedLength()
public static long liveElements(long numElements, int numTasks, int taskNumber)
public long longElementsPerTask()
public long[] longIndexRange()
public long longLiveElements()
public long longOriginalLength()
public long longPaddedLength()
public static int paddedLength(int numElements, int numTasks)
length
- input lengthnumTasks
- number of tasks for the parallel decomposition
public void setBlockDecomp(long numElements, int numTasks, int taskNumber)
public void setCircularDecomp(long numElements, int numTasks, int taskNumber)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |