I am facing a problem that MPI-IO does not return error codes consistently. For example, when file open mode (access mode) is not the same among all processes, MPI should return MPI_ERR_NOT_SAME. But some MPI versions (older MPICH and OpenMPI) return MPI_ERR_AMODE instead.
PnetCDF relies on MPI error classes to produce corresponding error codes in PnetCDF. For instance, starting from PnetCDF 1.4.0, MPI_ERR_AMODE is translated to NC_EMULTIDEFINE_OMODE. However, MPI_ERR_AMODE does not just mean inconsistent file access mode, and hence this needs to change.
In this commit, I create a new error code NC_EMULTIDEFINE_FNC_ARGS corresponding to MPI_ERR_NOT_SAME. If PnetCDF omode or cmode is inconsistent, then it reports NC_EMULTIDEFINE_FNC_ARGS if MPI-IO can return MPI_ERR_NOT_SAME correctly. Otherwise, if MPI-IO retruns MPI_ERR_AMODE, then we still translate it to NC_EMULTIDEFINE_OMODE, as in PnetCDF there is no other way to cause MPI_ERR_AMODE.



git-svn-id: https://svn.mcs.anl.gov/repos/parallel-netcdf/trunk@1655 c368ceb8-fd28-0410-a457-e46ee1d7cd4a