mpi_initialize が実際に初期化した場合のみ MPI_Finalize を呼ぶ。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(inout) | :: | ctx |
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