Next: Message Passing
Up: hw3
Previous: hw3
The library has been structured in the following fashion. All the files are
under the main directory GridComm. GridComm has following
subdirectories for convenient storage and easy accessibility :
- lib : This directory contains the compiled library archive
libGC.a which is to be linked to the test programs.
- include : This directory contains the following `.h'
files which contain the declarations of the functions etc. - GCcommon.h, GCerror.h and GCinclude.h. In particular, GCerror.h contains the definitions for the functions which return error
message if there is some error in any of the following processes :
printing, memory allocation and memory freeing.
- src : Contains all the source files of the library. All the files
are listed below with a brief description of their use.
- 1.
- GCinit - This is the initialization of the communicators -
GridComm and MPI. GridComm is a new communicator defined in order to
differentiate it from the MPI_COMM_WORLD. The communicator has two groups
one each for communicating east-west and north-south. Arguments to GCinit :
- int argc - count of number of command line arguments
- int args - the command line arguments
- 2.
- GCpartitionGrid - This is useful for partitioning the grid among
the various processors. Actually, the full grid is never read, so the term
`partition' is a little misleading. The initial grid and the boundary
conditions are read in separate chunks by each processor. GCpartitionGrid just
correlates the local indices to the global indices of the grid.
Arguments to GCpartitionGrid :
- int gridSize[2] :: global grid size in `x' and `y' directions (input)
- int procTotal[2] :: number of processors in `x' and `y' directions (input)
- int globalStartIndex[2] :: global start index for each processor (output)
- int globalEndIndex[2] :: global end index for each processor (output)
- int procIndex[2] :: processor indexing in `x' and `y' directions (output)
- 3.
- GCgetGridDataPtr : Gets the pointer to the grid data
- 4.
- GCinitGrid : Does memory allocation for grid on each
processor taking care of the ghost cells. Each grid size is
(nx+ghostx) x (ny+ghosty). This does the memory allocation for the
grid on each processor. Arguments to GCinitGrid.
- GCgrid **grid :: double pointer to the Grid structure (since memory allocation is to be done) (input/output)
- ghostSize[2], procIndex[2], globalStartIndex[2] & globalEndIndex[2] : standard definitions
- double (*BCfunc)(double u, double v) :: function for boundary conditions passed as an argument; `u' and `v' are calculated here which give the correlation between global and local grid (output)
- 5.
- GCinitBC : To specify the boundary conditions on each processor. Boundary conditions are input by the user in the main program in the parametric space, as functions of `x' and `y'. Arguments to GCinitBC.
- GCgrid *grid :: pointer to the Grid structure `GCgrid' (output)
- double (*BCfunc)(double u, double v) :: function for boundary conditions passed as an argument (input)
- int *procTotal :: total number of proc. in `x' and `y' directions (input)
- *globalStartIndex & *globalEndIndex :: global start/stop indices in `x' and `y' directions (input)
- 6.
- GCupdateGrid : This is function which takes care of all the memory passing among processors. GCgrid *grid is the only input/output. Works for any number of ghost cells as prescribed by the user in the main program.
- 7.
- GCfreeGrid : To free the memory allocated to `grid' on each proc. Arguments :
- *grid :: pointer to the Grid structure `GCgrid'
- 8.
- GCerror - Contains routines which check if there is any
error in printing, memory allocation or memory freeing. If there is any error
these provide a safe exit to the program with the an `understandable'
error message.
- 9.
- GCutilities - For the present this contains only one routine which
checks if the processor is the master processor or not. This can be used to
contain other routines which may be handy.
- 10.
- GCnorm : This shall be used to calculate the error norm to check the convergence.
- 11.
- GCfinalize - This just finalizes the MPI.
- obj : This just contains the object files obtained after
compilation from the source files of the library routines.
- test : For the present the Jacobi relaxation has been implemented in `test1.c' file. The relaxation can be done on any grid and any number of processors.
Next: Message Passing
Up: hw3
Previous: hw3
Anirudh Modi
2000-03-21