diff --git a/src/clib/pio_file.c b/src/clib/pio_file.c index f4b91d1bf98..631d1fa0c85 100644 --- a/src/clib/pio_file.c +++ b/src/clib/pio_file.c @@ -159,16 +159,9 @@ PIOc_createfile(int iosysid, int *ncidp, int *iotype, const char *filename, if ((ret = PIOc_createfile_int(iosysid, ncidp, iotype, filename, mode, 0))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - /* Run this on all tasks if async is not in use, but only on - * non-IO tasks if async is in use. (Because otherwise, in async - * mode, set_fill would be called twice by each IO task, since - * PIOc_createfile() will already be called on each IO task.) */ - if (!ios->async || !ios->ioproc) - { - /* Set the fill mode to NOFILL. */ - if ((ret = PIOc_set_fill(*ncidp, NC_NOFILL, NULL))) - return ret; - } + /* Set the fill mode to NOFILL. */ + if ((ret = PIOc_set_fill(*ncidp, NC_NOFILL, NULL))) + return ret; return ret; } diff --git a/src/clib/pio_msg.c b/src/clib/pio_msg.c index 35a15b4853c..06fecf8a9ed 100644 --- a/src/clib/pio_msg.c +++ b/src/clib/pio_msg.c @@ -168,12 +168,19 @@ int set_fill_handler(iosystem_desc_t *ios) */ int create_file_handler(iosystem_desc_t *ios) { +<<<<<<< HEAD +======= + int ncid = 0; +>>>>>>> master int len; int iotype; int mode; int use_ext_ncid; char ncidp_present; +<<<<<<< HEAD int *ncidp = NULL; +======= +>>>>>>> master int mpierr; PLOG((1, "create_file_handler comproot = %d", ios->comproot)); @@ -197,12 +204,15 @@ int create_file_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&ncidp_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); + if (ncidp_present) + if ((mpierr = MPI_Bcast(&ncid, 1, MPI_INT, 0, ios->intercomm))) + return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); PLOG((1, "create_file_handler len %d filename %s iotype %d mode %d " - "use_ext_ncid %d ncidp_present %d", len, filename, iotype, mode, - use_ext_ncid, ncidp_present)); + "use_ext_ncid %d ncidp_present %d ncid %d", len, filename, iotype, mode, + use_ext_ncid, ncidp_present, ncid)); /* Call the create file function. */ - PIOc_createfile_int(ios->iosysid, ncidp, &iotype, filename, mode, + PIOc_createfile_int(ios->iosysid, &ncid, &iotype, filename, mode, use_ext_ncid); PLOG((1, "create_file_handler succeeded!")); diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index 01f8a064190..f23ef6a79c6 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -2003,6 +2003,7 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, if (!ios->ioproc) { int msg = PIO_MSG_CREATE_FILE; + char ncidp_present = ncidp ? 1 : 0; size_t len = strlen(filename); char ncidp_present = ncidp ? 1 : 0; @@ -2024,8 +2025,12 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, mpierr = MPI_Bcast(&use_ext_ncid, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&ncidp_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - PLOG((2, "len %d filename %s iotype %d mode %d use_ext_ncid %d ncidp_present %d", - len, filename, file->iotype, mode, use_ext_ncid, ncidp_present)); + if (ncidp_present) + if (!mpierr) + mpierr = MPI_Bcast(ncidp, 1, MPI_INT, ios->compmaster, ios->intercomm); + PLOG((2, "len %d filename %s iotype %d mode %d use_ext_ncid %d " + "ncidp_present %d", len, filename, file->iotype, mode, + use_ext_ncid, ncidp_present)); } /* Handle MPI errors. */