diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-03-01 15:25:31 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-03-01 15:25:31 +0000 |
commit | 5aefbc571e067944423d1f5cb2a83cec17f9da25 (patch) | |
tree | 1528393c6b2807cbf7b9bc23f14a8e3f0fad72a3 /src/main/ShutdownCactus.c | |
parent | 22bb0dd378621db596f04635f20f2e55c5413336 (diff) |
Move the output of the schedule timers and the call to MPI_Finalize
from CactusDefaultShutdown to CCTKi_ShutdownCactus, which is executed
as the last function. This also means that drivers don't have to do
this any more, as it is now always done by the flesh.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4467 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ShutdownCactus.c')
-rw-r--r-- | src/main/ShutdownCactus.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/ShutdownCactus.c b/src/main/ShutdownCactus.c index 1ed6155c..63fb720d 100644 --- a/src/main/ShutdownCactus.c +++ b/src/main/ShutdownCactus.c @@ -16,10 +16,40 @@ #include "cctk_Parameters.h" #include "cctk_Schedule.h" +#ifdef CCTK_MPI +#include "mpi.h" +#endif + static const char *rcsid = "$Header$"; CCTK_FILEVERSION(main_ShutdownCactus_c); +#ifdef CCTK_MPI +extern char MPI_Active; +#endif + +#ifdef CCTK_MPI +#define CACTUS_MPI_ERROR(xf) \ + do \ + { \ + int errcode; \ + \ + \ + if((errcode = xf) != MPI_SUCCESS) \ + { \ + char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \ + int resultlen; \ + \ + \ + MPI_Error_string(errcode, mpi_error_string, &resultlen); \ + fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \ + #xf, errcode, mpi_error_string); \ + fprintf(stderr, "At line %d of file %s\n", \ + __LINE__, __FILE__); \ + } \ + } while (0) +#endif + /*@@ @routine CCTKi_ShutdownCactus @date Mon Sep 28 14:50:50 1998 @@ -53,5 +83,16 @@ int CCTKi_ShutdownCactus(tFleshConfig *ConfigData) CCTK_SchedulePrintTimes (NULL); } + printf("--------------------------------------------------------------------------------\n"); + printf("Done.\n"); + fflush(stdout); + +#ifdef CCTK_MPI + if(MPI_Active) + { + CACTUS_MPI_ERROR(MPI_Finalize()); + } +#endif + return 0; } |