What is the reliable way to return error code from an MPI program?

Posted by mezhaka on Stack Overflow See other posts from Stack Overflow or by mezhaka
Published on 2010-03-19T12:04:57Z Indexed on 2010/03/19 12:11 UTC
Read the original article Hit count: 177

Filed under:

The MPI standard (page 295) says:

Advice to users. Whether the errorcode is returned from the executable or from the MPI process startup mechanism (e.g., mpiexec), is an aspect of quality of the MPI library but not mandatory.

Indeed I had no success in running the following code:

if(0 == my_rank)
{
   FILE* parameters = fopen("parameters.txt", "r");
   if(NULL == parameters)
   {
     fprintf(stderr, "Could not open parameters.txt file.\n");
     printf("Could not open parameters.txt file.\n");
     exit(EXIT_FAILURE); //Tried MPI_Abort() as well
   }
   fscanf(parameters, "%i %f %f %f", N, X_DIMENSION_Dp, Y_DIMENSION_Dp, HEIGHT_DIMENSION_Dp);
   fclose(generation_conf);
}

I am not able to get the error code back into the shell in order to make a decision on further actions. Neither of two error messages are printed. I think I might write the error codes and messages to a dedicated file.

Has anyone ever had a similar problem and what were the options you've considered to do a reliable error reporting?

© Stack Overflow or respective owner

Related posts about mpi