Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ATPESC-IO
hands-on-2015
Commits
cadaf2bd
Commit
cadaf2bd
authored
Aug 11, 2015
by
Rob Latham
Browse files
fix build errors in pnetcdf example
parent
5c2d44ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
mpi2tutorial/examples/life/mlife-io-pnetcdf.c
View file @
cadaf2bd
...
...
@@ -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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment