Commit cadaf2bd authored by Rob Latham's avatar Rob Latham
Browse files

fix build errors in pnetcdf example

parent 5c2d44ea
......@@ -23,6 +23,10 @@
*/
static MPI_Comm mlifeio_comm = MPI_COMM_NULL;
static int MLIFEIO_Type_create_rowblk(int **matrix, int myrows,
int cols,
MPI_Datatype *newtype);
int MLIFEIO_Init(MPI_Comm comm)
{
int err;
......@@ -60,6 +64,7 @@ int MLIFEIO_Checkpoint(char *prefix, int **matrix, int rows,
MPI_Offset start[2];
MPI_Offset count[2];
int i, j, *buf;
MPI_Datatype type;
char filename[64];
......@@ -188,3 +193,31 @@ int MLIFEIO_Restart(char *prefix, int **matrix, int rows,
return MPI_SUCCESS;
}
/* SLIDE: Placing Data in Checkpoint */
/* MLIFEIO_Type_create_rowblk
*
* See stdio version for details (this is a copy).
*/
static int MLIFEIO_Type_create_rowblk(int **matrix, int myrows,
int cols,
MPI_Datatype *newtype)
{
int err, len;
MPI_Datatype vectype;
MPI_Aint disp;
/* since our data is in one block, access is very regular */
err = MPI_Type_vector(myrows, cols, cols+2, MPI_INTEGER,
&vectype);
if (err != MPI_SUCCESS) return err;
/* wrap the vector in a type starting at the right offset */
len = 1;
MPI_Get_address(&matrix[1][1], &disp);
err = MPI_Type_create_hindexed(1,&len,&disp,vectype,newtype);
MPI_Type_free(&vectype); /* decrement reference count */
return err;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment