ArrDescrCreateReaderComm Subroutine

public subroutine ArrDescrCreateReaderComm(arrdes, full_comm, num_readers, rc)

Arguments

Type IntentOptional Attributes Name
type(ArrDescr), intent(inout) :: arrdes
integer, intent(in) :: full_comm
integer, intent(in) :: num_readers
integer, intent(out), optional :: rc

Calls

proc~~arrdescrcreatereadercomm~~CallsGraph proc~arrdescrcreatereadercomm ArrDescrCreateReaderComm interface~mapl_assert MAPL_Assert proc~arrdescrcreatereadercomm->interface~mapl_assert mpi_comm_rank mpi_comm_rank proc~arrdescrcreatereadercomm->mpi_comm_rank mpi_comm_split mpi_comm_split proc~arrdescrcreatereadercomm->mpi_comm_split proc~mapl_return MAPL_Return proc~arrdescrcreatereadercomm->proc~mapl_return proc~mapl_verify MAPL_Verify proc~arrdescrcreatereadercomm->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~arrdescrcreatereadercomm~~CalledByGraph proc~arrdescrcreatereadercomm ArrDescrCreateReaderComm proc~mapl_esmfstatereadfromfile MAPL_ESMFStateReadFromFile proc~mapl_esmfstatereadfromfile->proc~arrdescrcreatereadercomm proc~mapl_genericfinalize MAPL_GenericFinalize proc~mapl_genericfinalize->proc~arrdescrcreatereadercomm proc~mapl_genericrecord MAPL_GenericRecord proc~mapl_genericrecord->proc~arrdescrcreatereadercomm proc~mapl_genericstatesave MAPL_GenericStateSave proc~mapl_genericstatesave->proc~arrdescrcreatereadercomm proc~mapl_genericstatesave->proc~mapl_genericstatesave proc~mapl_genericinitialize MAPL_GenericInitialize proc~mapl_genericinitialize->proc~mapl_esmfstatereadfromfile proc~mapl_genericrefresh MAPL_GenericRefresh proc~mapl_genericrefresh->proc~mapl_esmfstatereadfromfile proc~mapl_genericrefresh->proc~mapl_genericrefresh proc~mapl_genericstaterestore MAPL_GenericStateRestore proc~mapl_genericstaterestore->proc~mapl_esmfstatereadfromfile proc~mapl_genericstaterestore->proc~mapl_genericstaterestore

Source Code

    subroutine ArrDescrCreateReaderComm(arrdes, full_comm, num_readers, rc)
       type(ArrDescr), intent(inout) :: arrdes
       integer, intent(in) :: full_comm
       integer, intent(in) :: num_readers
       integer, optional, intent(out) :: rc

       integer :: status, nx, ny, color, ny_by_readers, myid, j

       nx = size(arrdes%i1)
       ny = size(arrdes%j1)
       _ASSERT(num_readers <= ny,'num readers must be less than or equal to NY')
       _ASSERT(mod(ny,num_readers)==0,'num readers must evenly divide NY')

       call mpi_comm_rank(full_comm,myid, status)
       _VERIFY(status)
       color =  arrdes%NX0
       call MPI_COMM_SPLIT(full_comm, color, MYID, arrdes%Ycomm, status)
       _VERIFY(status)
       color = arrdes%NY0
       call MPI_COMM_SPLIT(full_comm, color, MYID, arrdes%Xcomm, status)
       _VERIFY(status)
       ny_by_readers = ny/num_readers
       if (mod(myid,nx*ny/num_readers) == 0) then
          color = 0
       else
          color = MPI_UNDEFINED
       endif
       call MPI_COMM_SPLIT(full_comm, color, MYID, arrdes%readers_comm, status)
       _VERIFY(status)
       if (num_readers==ny) then
          arrdes%IOscattercomm = arrdes%Xcomm
       else
          j = arrdes%NY0 - mod(arrdes%NY0-1,ny_by_readers)
          call MPI_COMM_SPLIT(full_comm, j, MYID, arrdes%IOscattercomm, status)
          _VERIFY(status)
       endif

       _RETURN(_SUCCESS)

    end subroutine ArrDescrCreateReaderComm