Skip to content

Commit 9ecfb68

Browse files
committed
testcases/file_create_open.c test with adding an MPI info object
1 parent de263a3 commit 9ecfb68

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

test/testcases/file_create_open.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ int main(int argc, char **argv)
2121
char filename[512];
2222
int i, err, nprocs, rank, nerrs=0, ncid;
2323
int format[3] = {0, NC_64BIT_OFFSET, NC_64BIT_DATA};
24+
MPI_Info info=MPI_INFO_NULL;
2425

2526
MPI_Init(&argc, &argv);
2627
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@@ -41,25 +42,32 @@ int main(int argc, char **argv)
4142
free(cmd_str);
4243
}
4344

45+
MPI_Info_create(&info);
46+
MPI_Info_set(info, "nc_header_align_size", "100");
47+
MPI_Info_set(info, "nc_var_align_size", "200");
48+
MPI_Info_set(info, "nc_record_align_size", "300");
49+
4450
for (i=0; i<3; i++) {
4551
/* Create a new file */
4652
int cmode = NC_CLOBBER | format[i];
47-
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, MPI_INFO_NULL, &ncid);
53+
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, info, &ncid);
4854
CHECK_ERR
4955

5056
/* Close the file. */
5157
err = ncmpi_close(ncid);
5258
CHECK_ERR
5359

5460
/* Open the file */
55-
err = ncmpi_open(MPI_COMM_WORLD, filename, NC_WRITE, MPI_INFO_NULL, &ncid);
61+
err = ncmpi_open(MPI_COMM_WORLD, filename, NC_WRITE, info, &ncid);
5662
CHECK_ERR
5763

5864
/* Close the file. */
5965
err = ncmpi_close(ncid);
6066
CHECK_ERR
6167
}
6268

69+
if (info != MPI_INFO_NULL) MPI_Info_free(&info);
70+
6371
/* check if there is any malloc residue */
6472
MPI_Offset malloc_size, sum_size;
6573
err = ncmpi_inq_malloc_size(&malloc_size);

0 commit comments

Comments
 (0)