don't use MPI_COMM_WORLD as default
@@ -2392,13 +2392,10 @@ openmagic(struct MagicFile* file)
if (file->use_parallel) {
int retval;
MPI_Offset size;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
- if(file->parameters != NULL) {
- comm = ((NC_MPI_INFO*)file->parameters)->comm;
- info = ((NC_MPI_INFO*)file->parameters)->info;
- }
- if((retval = MPI_File_open(comm,(char*)file->path,MPI_MODE_RDONLY,info,
+ assert(file->parameters);
+ if((retval = MPI_File_open(((NC_MPI_INFO*)file->parameters)->comm,
+ (char*)file->path,MPI_MODE_RDONLY,
+ ((NC_MPI_INFO*)file->parameters)->info,
&file->fh)) != MPI_SUCCESS)
{status = NC_EPARINIT; goto done;}
/* Get its length */
