[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #IUF-923302]: NetCDF 4.1.3 and OpenMPI



Hi Reto,

re:
> I have found a bug fix for the issue with parallel I/O reported earlier
> (I had no response from netcdf on that earlier report, so there is no
> ticket number in this e-mail).

Since our inquiry tracking system automatically sends an acknowledgement upon
receipt of a new support request, and since you did not receive this 
notification
with your previous post, we must assume that either we did not receive your
previous post, or it was improperly discarded by our spam processing.  We
apologize for the improper handling of that email!

Thank you for providing a detailed explanation of the solution to the
problem coupled with reworked code.  Our netCDF developer(s) will review
your solution and fold it into future releases if possible.
 
> The problem with parallel C and F90 I/O appears only with MPI
> implementations that include MPI_COMM_F2C and MPI_INFO_F2C functions,
> such as for instance OpenMPI. The problem is a bug in
> libdispatch/parallel.c of NetCDF 4.1.3.
> 
> The two functions MPI_COMM_F2C and MPI_INFO_F2C transform the MPI
> communicator and info handles from Fortran to C when netcdf is called
> from a fortran code in parallel mode. They are correctly implemented in
> nc_create_par_fortran() and nc_open_par_fortran() and they work. They
> however should be removed from nc_create_par() since the communicator
> and info handles passed to that particular routine are always in C.
> Fom Fortran the nc_create_par_fortran is always called first and already
> performs the transformation from Fortran to C. If that transformation
> happens again, an error occurs.
> 
> I've tested the bug fix with the C and F90 test code (parallels/serial)
> and OpenMPI on OSX and gcc 4.4.4. I think that it should be generally
> applicable.
> 
> Sincerely,
> Reto Stockli
> 
> 
> See here the modified nc_create_par() code from parallel.c :
> 
> 
> /* This function creates a file for use with parallel I/O. */
> int
> nc_create_par(const char *path, int cmode, MPI_Comm comm,
> MPI_Info info, int *ncidp)
> {
> #ifndef USE_PARALLEL
> return NC_ENOPAR;
> #else
> NC_MPI_INFO data;
> 
> /* comm and info are already transformed from Fortran to C in the
> previous call nc_create_par_fortran, so they are C-like here.
> There is no need to transform them again since this leads to
> an error with MPI implementations that have the MPI_COMM_F2C
> routine implemented. */
> 
> /* remove : */
> //   MPI_Comm comm_c = 0;
> //   MPI_Info info_c = 0;
> 
> /* One of these two parallel IO modes must be chosen by the user,
> * or else pnetcdf must be in use. */
> if (!(cmode & NC_MPIIO || cmode & NC_MPIPOSIX) &&
> !(cmode & NC_PNETCDF))
> return NC_EINVAL;
> 
> /* remove: */
> /*
> #ifdef HAVE_MPI_COMM_F2C
> comm_c = MPI_Comm_f2c(comm);
> info_c = MPI_Info_f2c(info);
> #else
> comm_c = (MPI_Comm)comm;
> info_c = (MPI_Info)info;
> #endif
> 
> data.comm = comm_c;
> data.info = info_c;
> */
> 
> /* add: */
> data.comm = comm;
> data.info = info;
> 
> 
> return NC_create(path, cmode, 0, 0, NULL, 1, &data, ncidp);
> #endif /* USE_PARALLEL */
> }

Cheers,

Tom
--
****************************************************************************
Unidata User Support                                    UCAR Unidata Program
(303) 497-8642                                                 P.O. Box 3000
address@hidden                                   Boulder, CO 80307
----------------------------------------------------------------------------
Unidata HomePage                       http://www.unidata.ucar.edu
****************************************************************************


Ticket Details
===================
Ticket ID: IUF-923302
Department: Support netCDF
Priority: Normal
Status: Open