Skip to content

Commit

Permalink
Merge branch 'mpi_free_fix' (PR #4)
Browse files Browse the repository at this point in the history
Some minor MPI-related issues were found during testing of CESM/MCT with valgrind. Most
notably MCTWorld communicator is never freed, which was contributing to MPI-related spam from memcheck.
  • Loading branch information
rljacob committed Jan 5, 2015
2 parents ff61f8a + ff704ff commit 4fbc980
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mct/m_MCTWorld.F90
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ subroutine initm_(ncomps,globalcomm,mycomms,myids)
! First on the global root, post a receive for each component
if(myGid == 0) then
do i=1,ncomps
apoint => tmparray(0:Gsize-1,i)
call MPI_IRECV(apoint(1), root_nprocs(i),MP_INTEGER, &
apoint => tmparray(0:root_nprocs(i)-1,i)
call MPI_IRECV(apoint, root_nprocs(i),MP_INTEGER, &
MP_ANY_SOURCE,i,globalcomm, reqs(i), ier)
if(ier /= 0) call MP_perr_die(myname_,'MPI_IRECV()',ier)
enddo
Expand Down Expand Up @@ -569,6 +569,7 @@ subroutine clean_()
!
! !USES:
!
use m_mpif90
use m_die

implicit none
Expand All @@ -590,6 +591,9 @@ subroutine clean_()
deallocate(ThisMCTWorld%nprocspid,ThisMCTWorld%idGprocid,stat=ier)
if(ier /= 0) call warn(myname_,'deallocate(MCTW,...)',ier)

call MP_comm_free(ThisMCTWorld%MCT_comm, ier)
if(ier /= 0) call MP_perr_die(myname_,'MP_comm_free()',ier)

ThisMCTWorld%ncomps = 0
ThisMCTWorld%mygrank = 0

Expand Down
1 change: 1 addition & 0 deletions mct/m_SparseMatrixPlus.F90
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ subroutine initFromRoot_(sMatPlus, sMat, xGSMap, yGSMap, strategy, &
! instead.
write(stderr,'(4a)') myname_, &
':: ERROR--Strategy name = ',strategy,' not supported by this routine.'
call die(myname_)
case default ! strategy name not recognized.
write(stderr,'(5a)') myname_, &
':: ERROR--Invalid parallelization strategy name = ',strategy,' not ', &
Expand Down

0 comments on commit 4fbc980

Please sign in to comment.