<p><b>duda</b> 2010-03-16 18:18:37 -0600 (Tue, 16 Mar 2010)</p><p>BRANCH COMMIT<br>
<br>
When using an externally-supplied MPI communicator in the dmpar module,<br>
we don't want to call MPI_Finalize() when dmpar_finalize() is called,<br>
since the external code that supplied the communicator is expected to<br>
do this.<br>
<br>
M module_dmpar.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/mpas_cam_coupling/src/framework/module_dmpar.F
===================================================================
--- branches/mpas_cam_coupling/src/framework/module_dmpar.F        2010-03-16 22:49:50 UTC (rev 140)
+++ branches/mpas_cam_coupling/src/framework/module_dmpar.F        2010-03-17 00:18:37 UTC (rev 141)
@@ -18,6 +18,7 @@
type dm_info
integer :: nprocs, my_proc_id, comm, info
+ logical :: using_external_comm
end type dm_info
@@ -57,9 +58,11 @@
if (present(mpi_comm)) then
dminfo % comm = mpi_comm
+ dminfo % using_external_comm = .true.
else
call MPI_Init(mpi_ierr)
dminfo % comm = MPI_COMM_WORLD
+ dminfo % using_external_comm = .false.
end if
! Find out our rank and the total number of processors
@@ -78,6 +81,7 @@
dminfo % comm = 0
dminfo % my_proc_id = IO_NODE
dminfo % nprocs = 1
+ dminfo % using_external_comm = .false.
#endif
end subroutine dmpar_init
@@ -92,7 +96,9 @@
#ifdef _MPI
integer :: mpi_ierr
- call MPI_Finalize(mpi_ierr)
+ if (.not. dminfo % using_external_comm) then
+ call MPI_Finalize(mpi_ierr)
+ end if
#endif
end subroutine dmpar_finalize
</font>
</pre>