diff options
author | tradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2003-12-01 22:50:36 +0000 |
---|---|---|
committer | tradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2003-12-01 22:50:36 +0000 |
commit | ce1bd89ec14535514c529b28c381a3c3e841526b (patch) | |
tree | 793674a51ce830af8a34a09d5f544c5d99d34c78 /src/SetupPGV.c | |
parent | f6a8262ccb22d44d19707bf25b39ebbe30f6c66a (diff) |
Bug was discovered by Fokke Dijkstra: manual partitioning settings was
applied to both grid function and grid array variables. Should be done
only for grid functions, of course.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@424 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r-- | src/SetupPGV.c | 207 |
1 files changed, 50 insertions, 157 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c index a1554a8..4eca675 100644 --- a/src/SetupPGV.c +++ b/src/SetupPGV.c @@ -55,14 +55,9 @@ static int IntSort(const void *a, const void *b); @desc Sets up a PGExtras structure. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ -pGExtras *PUGH_SetupPGExtras(int dim, +pGExtras *PUGH_SetupPGExtras(int is_gf, + int dim, int *perme, int stagger, int *sh, @@ -74,7 +69,7 @@ pGExtras *PUGH_SetupPGExtras(int dim, int error; pGExtras *this; - this = (pGExtras *)malloc(sizeof(pGExtras)); + this = malloc(sizeof(pGExtras)); /* Setup memory */ if(this) @@ -89,7 +84,7 @@ pGExtras *PUGH_SetupPGExtras(int dim, this->dim = dim; - PUGH_SetupPGExtrasSizes(dim, perme, stagger, sh, nghosts, + PUGH_SetupPGExtrasSizes(is_gf, dim, perme, stagger, sh, nghosts, total_procs, nprocs, this_proc,this); PUGH_SetupPGExtrasOwnership(dim, perme, stagger, sh, nghosts, total_procs, nprocs, this_proc, this); @@ -109,12 +104,6 @@ pGExtras *PUGH_SetupPGExtras(int dim, @desc Destroys a PGExtras structure. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ void PUGH_DestroyPGExtras(pGExtras **PGExtras) { @@ -165,12 +154,6 @@ void PUGH_DestroyPGExtras(pGExtras **PGExtras) all the details of processor connectivities for this processor layout. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ pConnectivity *PUGH_SetupConnectivity(int dim, int total_procs, @@ -182,17 +165,17 @@ pConnectivity *PUGH_SetupConnectivity(int dim, int i; /* Allocate memory */ - this = (pConnectivity *)malloc(sizeof(pConnectivity)); + this = malloc(sizeof(pConnectivity)); if(this) { - this->nprocs = (int *)malloc(dim*sizeof(int)); - this->perme = (int *)malloc(dim*sizeof(int)); - this->neighbours = (int **)malloc(total_procs*sizeof(int *)); + this->nprocs = malloc(dim*sizeof(int)); + this->perme = malloc(dim*sizeof(int)); + this->neighbours = malloc(total_procs*sizeof(int *)); if(this->neighbours) { - this->neighbours[0] = (int *)malloc(total_procs*2*dim*sizeof(int)); + this->neighbours[0] = malloc(total_procs*2*dim*sizeof(int)); } else { @@ -253,12 +236,6 @@ pConnectivity *PUGH_SetupConnectivity(int dim, all the details of processor connectivities for this processor layout. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ void PUGH_DestroyConnectivity(pConnectivity **conn) { @@ -281,8 +258,6 @@ void PUGH_DestroyConnectivity(pConnectivity **conn) Generate the appropriate processor topology for this processor decomposition. @enddesc - @calls - @calledby @history @hdate Tue Jan 30 17:04:50 2001 @hauthor Tom Goodale @hdesc Added call to integer root function and qsort to @@ -290,7 +265,6 @@ void PUGH_DestroyConnectivity(pConnectivity **conn) demonstrable failure of the algorithm when dealing with large prime factors. @endhistory - @@*/ int PUGH_GenerateTopology(int dim, int total_procs, int *nprocs) { @@ -344,7 +318,7 @@ int PUGH_GenerateTopology(int dim, int total_procs, int *nprocs) int place; root = free_dims; - working = (int *)calloc(free_dims,sizeof(int)); + working = calloc(free_dims,sizeof(int)); #ifdef DEBUG_PUGH printf("Processor topology for dimension %d\n",dim); #endif @@ -397,12 +371,6 @@ int PUGH_GenerateTopology(int dim, int total_procs, int *nprocs) Works out the array of neighbouring processors for every processor. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ int PUGH_GenerateNeighbours(int dim, int total_procs, @@ -417,7 +385,7 @@ int PUGH_GenerateNeighbours(int dim, int *pos; int temp; - pos = (int *)malloc(dim*sizeof(int)); + pos = malloc(dim*sizeof(int)); if(dim == 0 || pos) { @@ -507,12 +475,6 @@ int PUGH_GenerateNeighbours(int dim, Decompose an ijk index into seperate components. Taken from libHLL. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ int PUGH_DecomposeIJK(int dim, int ijk, int *nprocs, int *pos) { @@ -543,12 +505,6 @@ int PUGH_DecomposeIJK(int dim, int ijk, int *nprocs, int *pos) Compose an ijk index from seperate components. Taken from libHLL. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ int PUGH_ComposeIJK(int dim, int *nprocs, @@ -579,12 +535,6 @@ int PUGH_ComposeIJK(int dim, @desc Allocate memory for the members of the pGExtras structure. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ int PUGH_SetupPGExtrasMemory(int dim, int total_procs, @@ -601,18 +551,18 @@ int PUGH_SetupPGExtrasMemory(int dim, /* Do it in stages. * First: things depending on the number of processors */ - this->lb = (int **)malloc(total_procs*sizeof(int *)); - this->ub = (int **)malloc(total_procs*sizeof(int *)); - this->rnsize = (int **)malloc(total_procs*sizeof(int *)); - this->rnpoints = (int *) malloc(total_procs*sizeof(int)); + this->lb = malloc(total_procs*sizeof(int *)); + this->ub = malloc(total_procs*sizeof(int *)); + this->rnsize = malloc(total_procs*sizeof(int *)); + this->rnpoints = malloc(total_procs*sizeof(int)); /* Things just depending on dimension */ - this->nghostzones = (int *)malloc(dim*sizeof(int)); - this->nsize = (int *)malloc(dim*sizeof(int)); - this->lnsize = (int *)malloc(dim*sizeof(int)); - this->bbox = (int *)malloc(2*dim*sizeof(int)); - this->iterator = (int *)malloc(dim*sizeof(int)); - this->hyper_volume = (int *)malloc(dim*sizeof(int)); + this->nghostzones = malloc(dim*sizeof(int)); + this->nsize = malloc(dim*sizeof(int)); + this->lnsize = malloc(dim*sizeof(int)); + this->bbox = malloc(2*dim*sizeof(int)); + this->iterator = malloc(dim*sizeof(int)); + this->hyper_volume = malloc(dim*sizeof(int)); /* Check all the above succeeded and then get memory for * arrays hanging off the above. @@ -628,9 +578,9 @@ int PUGH_SetupPGExtrasMemory(int dim, (dim == 0 || this->iterator ) && (dim == 0 || this->hyper_volume)) { - this->lb[0] = (int *)malloc(total_procs *dim*sizeof(int)); - this->ub[0] = (int *)malloc(total_procs *dim*sizeof(int)); - this->rnsize[0] = (int *)malloc(total_procs*2*dim*sizeof(int)); + this->lb[0] = malloc(total_procs *dim*sizeof(int)); + this->ub[0] = malloc(total_procs *dim*sizeof(int)); + this->rnsize[0] = malloc(total_procs*2*dim*sizeof(int)); if (dim > 0) { @@ -720,16 +670,16 @@ int PUGH_SetupPGExtrasMemory(int dim, { for (j = 0; j < 2; j++) { - this->ownership[i][j] = (int *) malloc(dim*sizeof(int)); - this->ghosts[i][j] = (int **)malloc(2*dim*sizeof(int *)); - this->overlap[i][j] = (int **)malloc(2*dim*sizeof(int *)); + this->ownership[i][j] = malloc(dim*sizeof(int)); + this->ghosts[i][j] = malloc(2*dim*sizeof(int *)); + this->overlap[i][j] = malloc(2*dim*sizeof(int *)); if(dim > 0) { if(this->ghosts[i][j] && this->overlap[i][j]) { - this->ghosts[i][j][0] = (int *)malloc(2*dim*dim*sizeof(int)); - this->overlap[i][j][0] = (int *)malloc(2*dim*dim*sizeof(int)); + this->ghosts[i][j][0] = malloc(2*dim*dim*sizeof(int)); + this->overlap[i][j][0] = malloc(2*dim*dim*sizeof(int)); for (k=1; k < 2*dim; k++) { this->ghosts[i][j][k] = this->ghosts[i][j][0] + k*dim; @@ -843,14 +793,9 @@ int PUGH_SetupPGExtrasMemory(int dim, Sets up the size information in the pGExtras structure. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ -int PUGH_SetupPGExtrasSizes(int dim, +int PUGH_SetupPGExtrasSizes(int is_gf, + int dim, int *perme, int stagger, int *sh, @@ -892,7 +837,8 @@ int PUGH_SetupPGExtrasSizes(int dim, /* Setup the bounding box stuff */ - PUGH_SetupBoundingBox(dim, + PUGH_SetupBoundingBox(is_gf, + dim, perme, stagger, sh, @@ -950,12 +896,6 @@ int PUGH_SetupPGExtrasSizes(int dim, Mostly taken from original SetupOwnership by Paul. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ int PUGH_SetupPGExtrasOwnership(int dim, int *perme, @@ -1098,7 +1038,7 @@ int PUGH_SetupPGExtrasStaggering(int dim, int s,d,k,dir; int *upperbnd; - upperbnd = (int*) malloc(dim*sizeof(int)); + upperbnd = malloc(dim*sizeof(int)); for (d=0;d<dim;d++) { @@ -1155,14 +1095,9 @@ int PUGH_SetupPGExtrasStaggering(int dim, @desc Sets up the bounding box info for a pgExtras structure. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ -int PUGH_SetupBoundingBox(int dim, +int PUGH_SetupBoundingBox(int is_gf, + int dim, int *perme, int stagger, int *sh, @@ -1176,14 +1111,14 @@ int PUGH_SetupBoundingBox(int dim, int **bounds; int *pos; - bounds = (int **)malloc(dim*sizeof(int*)); - pos = (int *)malloc(dim*sizeof(int)); + bounds = malloc(dim*sizeof(int*)); + pos = malloc(dim*sizeof(int)); if(dim > 0 && bounds && pos) { /* Work out the bounds in each direction - either from parameters file or default*/ - PUGH_GetBounds(dim, bounds, nprocs, this->nsize); + PUGH_GetBounds(is_gf, dim, bounds, nprocs, this->nsize); /* for (dir = 0 ; dir < dim; dir++) { @@ -1255,14 +1190,7 @@ int PUGH_SetupBoundingBox(int dim, @desc Determines info about the sizes on each processor. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ - int PUGH_SetupRemoteSizes(int dim, int *perme, int stagger, @@ -1299,11 +1227,6 @@ int PUGH_SetupRemoteSizes(int dim, @desc Sets up a communication buffer for a group of GAs. @enddesc - @calls - @calledby - @history - - @endhistory @@*/ pComm *PUGH_SetupGArrayGroupComm(pGH *pughGH, int dim, @@ -1317,19 +1240,19 @@ pComm *PUGH_SetupGArrayGroupComm(pGH *pughGH, pComm *this; - this = (pComm *) malloc (sizeof (pComm)); + this = malloc (sizeof (pComm)); if (this) { - this->buffer_sz = (int *) malloc (2 * dim * sizeof (int)); - this->send_buffer = (void **) malloc (2 * dim * sizeof (void *)); - this->recv_buffer = (void **) malloc (2 * dim * sizeof (void *)); + this->buffer_sz = malloc (2 * dim * sizeof (int)); + this->send_buffer = malloc (2 * dim * sizeof (void *)); + this->recv_buffer = malloc (2 * dim * sizeof (void *)); #ifdef CCTK_MPI - this->sreq = (MPI_Request *) malloc (2 * dim * sizeof (MPI_Request)); - this->rreq = (MPI_Request *) malloc (2 * dim * sizeof (MPI_Request)); - this->sstatus = (MPI_Status *) malloc (2 * dim * sizeof (MPI_Status)); + this->sreq = malloc (2 * dim * sizeof (MPI_Request)); + this->rreq = malloc (2 * dim * sizeof (MPI_Request)); + this->sstatus = malloc (2 * dim * sizeof (MPI_Status)); #endif - this->docomm = (int *) malloc (2 * dim * sizeof (int)); + this->docomm = malloc (2 * dim * sizeof (int)); if(this->buffer_sz && this->send_buffer && @@ -1429,11 +1352,6 @@ pComm *PUGH_SetupGArrayGroupComm(pGH *pughGH, @desc Sets up a communication buffer for a GA. @enddesc - @calls - @calledby - @history - - @endhistory @@*/ pComm *PUGH_SetupGArrayComm(pGH *pughGH, int dim, @@ -1459,11 +1377,6 @@ pComm *PUGH_SetupGArrayComm(pGH *pughGH, @desc Destroys a communication buffer. @enddesc - @calls - @calledby - @history - - @endhistory @@*/ void PUGH_DestroyComm(pComm **comm) { @@ -1489,12 +1402,6 @@ void PUGH_DestroyComm(pComm **comm) @desc Sets up a new pGA. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ pGA *PUGH_SetupGArray(void *parent, pGExtras *extras, @@ -1512,7 +1419,7 @@ pGA *PUGH_SetupGArray(void *parent, { pGA *this; - this = (pGA *)malloc(sizeof(pGA)); + this = malloc(sizeof(pGA)); if(this) { @@ -1528,7 +1435,7 @@ pGA *PUGH_SetupGArray(void *parent, this->arrayid = arrayid; this->storage = PUGH_NOSTORAGE; - this->name = (char *) malloc((strlen(name)+1)*sizeof(char)); + this->name = malloc((strlen(name)+1)*sizeof(char)); this->padddata = NULL; this->data = this->padddata; @@ -1565,12 +1472,6 @@ pGA *PUGH_SetupGArray(void *parent, @desc Destroys a pGA object. @enddesc - @calls - @calledby - @history - - @endhistory - @@*/ void PUGH_DestroyGArray(pGA **GA) { @@ -1611,24 +1512,16 @@ void PUGH_DestroyGArray(pGA **GA) @desc Generate the highest integer below a given integer root of an integer. @enddesc - @calls - @calledby - @history - - @endhistory + @var number @vdesc The number to take the root of @vtype int @vio in - @vcomment - @endvar @var invpower @vdesc The root to take @vtype int @vio in - @vcomment - @endvar @returntype int |