@brief Subroutine for finalizing MPI communications. @details This subroutine finalizes all the MPI communications and looks for errors durignt this procces.
@param[in] params Core KORC simulation parameters. @param mpi_process_finalized Flag indicating whether an individual MPI process was finalized correctly. @param mpierr MPI error status.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(in) | :: | params |
subroutine finalize_mpi(params)
TYPE(KORC_PARAMS), INTENT(IN) :: params
LOGICAL :: mpi_process_finalized = .FALSE.
INTEGER :: mpierr
call MPI_BARRIER(MPI_COMM_WORLD,mpierr)
call MPI_FINALIZE(mpierr)
call MPI_FINALIZED(mpi_process_finalized,mpierr)
if (.NOT.mpi_process_finalized) then
write(output_unit_write,'(/,"* * * * * * * COMMUNICATIONS * * * * * * *")')
write(output_unit_write,'(/," ERROR: MPI not finalized well. MPI process: ",I5)') params%mpi_params%rank
write(output_unit_write,'(/,"* * * * * * * * * ** * * * * * * * * * * *")')
end if
end subroutine finalize_mpi