00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <string.h> 00004 #include <math.h> 00005 #include <mpi.h> 00006 #include <signal.h> 00007 #include <unistd.h> 00008 00009 #include "allvars.h" 00010 #include "proto.h" 00011 00012 00025 void endrun(int ierr) 00026 { 00027 if(ierr) 00028 { 00029 printf("task %d: endrun called with an error level of %d\n\n\n", ThisTask, ierr); 00030 fflush(stdout); 00031 #ifdef DEBUG 00032 terminate_processes(); 00033 raise(SIGABRT); 00034 sleep(60); 00035 #else 00036 MPI_Abort(MPI_COMM_WORLD, ierr); 00037 #endif 00038 exit(0); 00039 } 00040 00041 MPI_Finalize(); 00042 exit(0); 00043 }