[1632] | 1 | ! |
---|
[1748] | 2 | ! $Id: abort_gcm.F 1747 2013-04-23 14:06:30Z lguez $ |
---|
[1632] | 3 | ! |
---|
[5246] | 4 | ! |
---|
| 5 | ! |
---|
| 6 | SUBROUTINE abort_gcm(modname, message, ierr) |
---|
| 7 | |
---|
[1632] | 8 | #ifdef CPP_IOIPSL |
---|
[5246] | 9 | USE IOIPSL |
---|
[1632] | 10 | #else |
---|
[5246] | 11 | ! if not using IOIPSL, we still need to use (a local version of) getin_dump |
---|
| 12 | USE ioipsl_getincom |
---|
[1632] | 13 | #endif |
---|
[5246] | 14 | USE parallel_lmdz |
---|
| 15 | INCLUDE "iniprint.h" |
---|
[1632] | 16 | |
---|
[5246] | 17 | ! |
---|
| 18 | ! Stops the simulation cleanly, closing files and printing various |
---|
| 19 | ! comments |
---|
| 20 | ! |
---|
| 21 | ! Input: modname = name of calling program |
---|
| 22 | ! message = stuff to print |
---|
| 23 | ! ierr = severity of situation ( = 0 normal ) |
---|
[1632] | 24 | |
---|
[5246] | 25 | character(len=*), intent(in):: modname |
---|
| 26 | integer :: ierr, ierror_mpi |
---|
| 27 | character(len=*), intent(in):: message |
---|
| 28 | |
---|
| 29 | write(lunout,*) 'in abort_gcm' |
---|
[1632] | 30 | #ifdef CPP_IOIPSL |
---|
[5246] | 31 | !$OMP MASTER |
---|
| 32 | call histclo |
---|
| 33 | call restclo |
---|
| 34 | if (MPI_rank .eq. 0) then |
---|
| 35 | call getin_dump |
---|
| 36 | endif |
---|
| 37 | !$OMP END MASTER |
---|
[1632] | 38 | #endif |
---|
[5246] | 39 | ! call histclo(2) |
---|
| 40 | ! call histclo(3) |
---|
| 41 | ! call histclo(4) |
---|
| 42 | ! call histclo(5) |
---|
| 43 | write(lunout,*) 'Stopping in ', modname |
---|
| 44 | write(lunout,*) 'Reason = ',message |
---|
| 45 | if (ierr .eq. 0) then |
---|
| 46 | write(lunout,*) 'Everything is cool' |
---|
| 47 | else |
---|
| 48 | write(lunout,*) 'Houston, we have a problem, ierr = ', ierr |
---|
[4600] | 49 | |
---|
[5246] | 50 | if (using_mpi) THEN |
---|
| 51 | !$OMP CRITICAL (MPI_ABORT_GCM) |
---|
| 52 | call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi) |
---|
| 53 | !$OMP END CRITICAL (MPI_ABORT_GCM) |
---|
| 54 | else |
---|
| 55 | stop 1 |
---|
| 56 | endif |
---|
| 57 | |
---|
| 58 | endif |
---|
| 59 | END SUBROUTINE abort_gcm |
---|