Skip to content

Commit f14152d

Browse files
committed
OpenMPI does not recognize file system type acronym prefixed to the file name
1 parent 4cf8ed8 commit f14152d

7 files changed

Lines changed: 48 additions & 6 deletions

File tree

src/dispatchers/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void set_get_comm_attr(MPI_Comm comm,
165165
* pncio_init_keyval is necessary for MPI_Finalize() to free key
166166
* pncio_node_ids_keyval.
167167
*/
168-
MPI_Comm_create_keyval(MPI_NULL_COPY_FN, PNCIO_end_call,
168+
MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, PNCIO_end_call,
169169
&pncio_init_keyval, (void*)0);
170170
MPI_Comm_set_attr(MPI_COMM_SELF, pncio_init_keyval, (void*)0);
171171
}

src/drivers/ncmpio/ncmpio_close.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ ncmpio_close(void *ncdp)
213213
#else
214214
MPI_File fh;
215215
int mpireturn;
216+
#ifdef MPICH_VERSION
217+
/* MPICH recognizes file system type acronym prefixed to the file name */
216218
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, ncp->path, MPI_MODE_RDWR, MPI_INFO_NULL, &fh));
219+
#else
220+
char *path = ncmpii_remove_file_system_type_prefix(ncp->path);
221+
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, path, MPI_MODE_RDWR, MPI_INFO_NULL, &fh));
222+
#endif
217223
if (mpireturn == MPI_SUCCESS) {
218224
/* obtain file size */
219225
MPI_Offset *file_size;

src/drivers/ncmpio/ncmpio_create.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ncmpio_create(MPI_Comm comm,
167167

168168
/* Extract hints from user_info. Two hints must be extracted now in order
169169
* to continue:
170-
* pnc_driver: whether to user MPI-IO or PnetCDF's PNCIO driver.
170+
* pnc_driver: whether to use MPI-IO or PnetCDF's PNCIO driver.
171171
* nc_num_aggrs_per_node: number of processes per node to be the INA
172172
* aggregators.
173173
*
@@ -274,7 +274,7 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
274274
#ifdef HAVE_UNLINK
275275
/* unlink() is likely faster then truncate(). However, unlink()
276276
* can be expensive when the file size is large. For example,
277-
* it taook 1.1061 seconds to delete a file of size 27.72 GiB
277+
* it took 1.1061 seconds to delete a file of size 27.72 GiB
278278
* on Perlmutter at NERSC.
279279
*/
280280
err = unlink(filename);
@@ -288,7 +288,12 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
288288
if (ncp->fstype != PNCIO_FSTYPE_MPIIO)
289289
err = PNCIO_File_delete(filename);
290290
else {
291+
#ifdef MPICH_VERSION
292+
/* MPICH recognizes file system type acronym prefixed to the file name */
291293
TRACE_IO(MPI_File_delete, (path, MPI_INFO_NULL));
294+
#else
295+
TRACE_IO(MPI_File_delete, (filename, MPI_INFO_NULL));
296+
#endif
292297
if (mpireturn != MPI_SUCCESS) {
293298
int errorclass;
294299
MPI_Error_class(mpireturn, &errorclass);
@@ -342,7 +347,12 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
342347
NCI_Free(pncio_fh);
343348
}
344349
else {
350+
#ifdef MPICH_VERSION
351+
/* MPICH recognizes file system type acronym prefixed to the file name */
345352
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, path, MPI_MODE_RDWR, MPI_INFO_NULL, &fh));
353+
#else
354+
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, filename, MPI_MODE_RDWR, MPI_INFO_NULL, &fh));
355+
#endif
346356
if (mpireturn != MPI_SUCCESS) {
347357
int errorclass;
348358
MPI_Error_class(mpireturn, &errorclass);
@@ -537,8 +547,8 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
537547
if (ncp->rank == 0 &&
538548
striping_factor * striping_unit == 0 &&
539549
striping_factor + striping_unit > 0) {
540-
/* rank 0 retreives folder's striping settings */
541-
lustre_get_striping(path, &striping_factor, &striping_unit);
550+
/* rank 0 retrieves folder's striping settings */
551+
lustre_get_striping(filename, &striping_factor, &striping_unit);
542552
/* error is ignored, if there is any */
543553
stripings[0] = striping_factor;
544554
stripings[1] = striping_unit;
@@ -558,7 +568,12 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
558568
}
559569
}
560570

571+
#ifdef MPICH_VERSION
572+
/* MPICH recognizes file system type acronym prefixed to the file name */
561573
TRACE_IO(MPI_File_open, (comm, path, mpiomode, user_info, &fh));
574+
#else
575+
TRACE_IO(MPI_File_open, (comm, filename, mpiomode, user_info, &fh));
576+
#endif
562577
if (mpireturn != MPI_SUCCESS) {
563578
#ifndef HAVE_ACCESS
564579
if (fIsSet(cmode, NC_NOCLOBBER)) {

src/drivers/ncmpio/ncmpio_file_io.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,15 +731,21 @@ ncmpio_file_delete(NC *ncp)
731731
int err=NC_NOERR;
732732

733733
if (ncp->rank == 0) {
734+
char *path = ncmpii_remove_file_system_type_prefix(ncp->path);
734735
if (ncp->fstype == PNCIO_FSTYPE_MPIIO) {
735736
char *mpi_name;
736737
int mpireturn;
738+
#ifdef MPICH_VERSION
739+
/* MPICH recognizes file system type acronym prefixed to the file name */
737740
TRACE_IO(MPI_File_delete, ((char *)ncp->path, ncp->mpiinfo));
741+
#else
742+
TRACE_IO(MPI_File_delete, (path, ncp->mpiinfo));
743+
#endif
738744
if (mpireturn != MPI_SUCCESS)
739745
err = ncmpii_error_mpi2nc(mpireturn, mpi_name);
740746
}
741747
else
742-
err = PNCIO_File_delete(ncp->path);
748+
err = PNCIO_File_delete(path);
743749
}
744750

745751
if (ncp->nprocs > 1)

src/drivers/ncmpio/ncmpio_file_misc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,15 @@ ncmpio_begin_indep_data(void *ncdp)
213213
if (ncp->independent_fh == MPI_FILE_NULL) {
214214
char *mpi_name;
215215
int mpireturn;
216+
#ifdef MPICH_VERSION
217+
/* MPICH recognizes file system type acronym prefixed to the file name */
216218
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, ncp->path, ncp->mpiomode,
217219
ncp->mpiinfo, &ncp->independent_fh));
220+
#else
221+
char *path = ncmpii_remove_file_system_type_prefix(ncp->path);
222+
TRACE_IO(MPI_File_open, (MPI_COMM_SELF, path, ncp->mpiomode,
223+
ncp->mpiinfo, &ncp->independent_fh));
224+
#endif
218225
if (mpireturn != MPI_SUCCESS)
219226
return ncmpii_error_mpi2nc(mpireturn, mpi_name);
220227

src/drivers/ncmpio/ncmpio_open.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ if (rank == 0) printf("%s at %d fstype=%s\n", __func__,__LINE__,(ncp->fstype ==
204204

205205
/* open file collectively ---------------------------------------------- */
206206
if (ncp->fstype == PNCIO_FSTYPE_MPIIO) {
207+
#ifdef MPICH_VERSION
208+
/* MPICH recognizes file system type acronym prefixed to the file name */
207209
TRACE_IO(MPI_File_open, (comm, path, mpiomode, user_info, &fh));
210+
#else
211+
TRACE_IO(MPI_File_open, (comm, filename, mpiomode, user_info, &fh));
212+
#endif
208213
if (mpireturn != MPI_SUCCESS) {
209214
err = ncmpii_error_mpi2nc(mpireturn, mpi_name);
210215
DEBUG_FOPEN_ERROR(err);

test/testcases/file_create_open.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ int test_io(const char *out_path,
6363
err = file_op(out_path, info_dup);
6464
if (err != 0) nerrs++;
6565

66+
#ifdef MPICH_VERSION
67+
/* MPICH recognizes file system type acronym prefixed to the file name */
6668
if (strncmp("ufs:", out_path, 4)) {
6769
char *prefix_fname;
6870
prefix_fname = (char*) malloc(strlen(out_path) + 10);
@@ -73,6 +75,7 @@ int test_io(const char *out_path,
7375

7476
free(prefix_fname);
7577
}
78+
#endif
7679

7780
if (info != MPI_INFO_NULL) MPI_Info_free(&info_dup);
7881

0 commit comments

Comments
 (0)