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