00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "adio.h"
00009 #include "adio_extern.h"
00010 
00011 
00012 
00013 
00014 int ADIOI_Error(ADIO_File fd, int error_code, char *string)
00015 {
00016     char buf[MPI_MAX_ERROR_STRING];
00017     int myrank, result_len; 
00018     MPI_Errhandler err_handler;
00019 
00020     if (fd == ADIO_FILE_NULL) err_handler = CtvAccess(ADIOI_DFLT_ERR_HANDLER);
00021     else err_handler = fd->err_handler;
00022 
00023     MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
00024     if (err_handler == MPI_ERRORS_ARE_FATAL) {
00025     MPI_Error_string(error_code, buf, &result_len);
00026     FPRINTF(stderr, "[%d] - %s : %s\n", myrank, string, buf);
00027     MPI_Abort(MPI_COMM_WORLD, 1);
00028     }
00029     else if (err_handler != MPI_ERRORS_RETURN) {
00030     
00031 
00032     FPRINTF(stderr, "Only MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL are currently supported as error handlers for files\n");
00033     MPI_Abort(MPI_COMM_WORLD, 1);
00034     }
00035 
00036     return error_code;
00037 }
00038