mpi_shutdown Subroutine

public subroutine mpi_shutdown(ctx)

mpi_initialize が実際に初期化した場合のみ MPI_Finalize を呼ぶ。

Arguments

Type IntentOptional Attributes Name
type(mpi_context), intent(inout) :: ctx

Called by

proc~~mpi_shutdown~~CalledByGraph proc~mpi_shutdown mpi_shutdown program~main main program~main->proc~mpi_shutdown

Source Code

  subroutine mpi_shutdown(ctx)
    type(mpi_context), intent(inout) :: ctx
#ifdef USE_MPI
    include 'mpif.h'
    logical :: is_finalized
    integer :: ierr

    if (ctx%initialized_here) then
      call MPI_Finalized(is_finalized, ierr)
      if (.not. is_finalized) call MPI_Finalize(ierr)
      ctx%initialized_here = .false.
    end if
#endif
    ctx%rank = 0_i32
    ctx%size = 1_i32
    ctx%enabled = .false.
  end subroutine mpi_shutdown