mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[svn-r17318] Did some code cleanup.
t_file.c: replace the old variable, color, with a more meaningfule name of is_old. t_mpi.c: use the official mpi_file_delete, instead of remove, to delete a file in MPI environment. Tested: Only jam in parallel as changes are trivial.
This commit is contained in:
parent
9d27b9765a
commit
da73cc2d02
@ -36,7 +36,7 @@ test_split_comm_access(void)
|
||||
int mpi_size, mpi_rank;
|
||||
MPI_Comm comm;
|
||||
MPI_Info info = MPI_INFO_NULL;
|
||||
int color, mrc;
|
||||
int is_old, mrc;
|
||||
int newrank, newprocs;
|
||||
hid_t fid; /* file IDs */
|
||||
hid_t acc_tpl; /* File access properties */
|
||||
@ -52,13 +52,13 @@ test_split_comm_access(void)
|
||||
/* set up MPI parameters */
|
||||
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
|
||||
color = mpi_rank%2;
|
||||
mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
|
||||
is_old = mpi_rank%2;
|
||||
mrc = MPI_Comm_split (MPI_COMM_WORLD, is_old, mpi_rank, &comm);
|
||||
VRFY((mrc==MPI_SUCCESS), "");
|
||||
MPI_Comm_size(comm,&newprocs);
|
||||
MPI_Comm_rank(comm,&newrank);
|
||||
|
||||
if (color){
|
||||
if (is_old){
|
||||
/* odd-rank processes */
|
||||
mrc = MPI_Barrier(comm);
|
||||
VRFY((mrc==MPI_SUCCESS), "");
|
||||
|
@ -286,8 +286,9 @@ test_mpio_gb_file(char *filename)
|
||||
VRFY((buf!=NULL), "malloc succeed");
|
||||
|
||||
/* open a new file. Remove it first in case it exists. */
|
||||
if (MAINPROCESS)
|
||||
remove(filename);
|
||||
/* Must delete because MPI_File_open does not have a Truncate mode. */
|
||||
/* Don't care if it has error. */
|
||||
MPI_File_delete(filename, MPI_INFO_NULL);
|
||||
MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
|
||||
|
||||
mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR,
|
||||
@ -490,6 +491,7 @@ test_mpio_1wMr(char *filename, int special_request)
|
||||
/* Must delete because MPI_File_open does not have a Truncate mode. */
|
||||
/* Don't care if it has error. */
|
||||
MPI_File_delete(filename, MPI_INFO_NULL);
|
||||
MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
|
||||
|
||||
if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
|
||||
MPI_MODE_RDWR | MPI_MODE_CREATE ,
|
||||
|
Loading…
Reference in New Issue
Block a user