2. A little more on Global Arrays.
2. A little more on Global Arrays.
2. A little more on Global Arrays.
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Data distributi<strong>on</strong> (regular vs. irregular)<br />
Regular distributi<strong>on</strong> of arrays:<br />
int NGA_Create(int type, int ndim, int dims[], char *array_name, int chunk[])<br />
array_name - a unique character string [input]<br />
type - data type (MT_F_DBL,MT_F_INT,MT_F_DCPL) [input]<br />
ndim - number of array dimensi<strong>on</strong>s [input]<br />
dims[ndim] - array of dimensi<strong>on</strong>s [input]<br />
chunk[ndim] - array of chunks, each element specifies<br />
minimum size that given dimensi<strong>on</strong>s should<br />
be chunked up into<br />
[input]<br />
chunk indicates the distributi<strong>on</strong> size for all or some of array dimensi<strong>on</strong>s. E.g., for a 2-dimensi<strong>on</strong>al<br />
array, 1) setting chunk[0]=dim[0] gives distributi<strong>on</strong> by vertical strips; 2) setting chunk[1]=dim[1]<br />
gives distributi<strong>on</strong> by horiz<strong>on</strong>tal strips.<br />
Actual chunks will be modified so that they are at least the size of the minimum and each process has<br />
either zero or <strong>on</strong>e chunk. Specifying chunk[i] as
Ghost arrays<br />
<strong>Arrays</strong> have data which are padded by a boundary regi<strong>on</strong> of array elements representing porti<strong>on</strong>s of the<br />
global array residing <strong>on</strong> other processors. These boundary regi<strong>on</strong>s can be updated with data from<br />
neighboring processors by a call to a single GA functi<strong>on</strong>. In order to create such global arrays, there are<br />
two calls for regular and irregular distributi<strong>on</strong> respectively:<br />
1) int NGA_Create_ghosts(int type, int ndim, int dims[], int<br />
width[],char *array_name, int chunk[])<br />
2) int NGA_Create_ghosts_irreg(int type, int ndim, int dims[], int<br />
width[], char *array_name, int map[], int block[])<br />
width is used to c<strong>on</strong>trol the width of the ghost cell boundaries in each dimensi<strong>on</strong> of the global array.<br />
Different dimensi<strong>on</strong>s can be padded with different numbers of ghost cells, although it is expected that<br />
for most applicati<strong>on</strong>s the widths will be the same for all dimensi<strong>on</strong>s.<br />
For a global array with ghost cells, the data distributi<strong>on</strong> can be visualized as follows:<br />
“ghost cell” can be updated in a single call to nga_update. To access the data in the ghost cells, the<br />
user must use the nga_access_ghosts functi<strong>on</strong>
N<strong>on</strong>-blocking <strong>on</strong>e-sided communicati<strong>on</strong><br />
The n<strong>on</strong>-blocking operati<strong>on</strong>s (get/put/accumulate) are derived from the blocking interface by adding a<br />
handle argument that identifies an instance of the n<strong>on</strong>-blocking request. The operati<strong>on</strong> can be<br />
completed locally by making a call to the wait (e.g. nga_nbwait) routine.<br />
Example: Let us take a simple case for illustrati<strong>on</strong>. Say, there are two global arrays i.e. <strong>on</strong>e array<br />
stores pressure and the other stores temperature. If there are two computati<strong>on</strong> phases (first phase<br />
computes pressure and sec<strong>on</strong>d phase computes temperature), then we can overlap communicati<strong>on</strong><br />
with computati<strong>on</strong>, thus hiding latency.<br />
. . . . . . . .<br />
nga_get (get_pressure_array)<br />
nga_nbget(initiates data transfer to get temperature_array, and returns immediately)<br />
compute_pressure() /* hiding latency - communicati<strong>on</strong> is overlapped with computati<strong>on</strong> */<br />
nga_nbwait(temperature_array - completes data transfer)<br />
compute_temperature()<br />
. . . . . . . .<br />
void NGA_NbPut(int g_a, int lo[], int hi[], void *buf, int ld[],<br />
ga_nbhdl_t* nbhandle)<br />
void NGA_NbGet(int g_a, int lo[], int hi[], void *buf, int ld[],<br />
ga_nbhdl_t* nbhandle)<br />
void NGA_NbAcc(int g_a, int lo[], int hi[], void *buf, int ld[],<br />
void *alpha, ga_nbhdl_t* nbhandle)<br />
int NGA_NbWait(ga_nbhdl_t* nbhandle)