This subroutine loads the communication pattern from a Lua script and sets the exchange routine to be used accordingly.
The variable read from the script is "commpattern". Several patterns are available: * isend_irecv - Use explicit buffers, copy first the outgoing ones, then post irecvs and isends, wait on all, and copy the incoming buffers to their final locations (default). * isend_irecv_mpimem - Same as isend_irecv, but use memory that is allocatd by MPI_Alloc_mem for the buffers. * isend_irecv_overlap - Similar to isend_irecv, but directly post sends, after filling the outgoing buffer to each process, wait on any incoming messages and only wait on sends, after everything is copied into the final location. * overlap_mpimem - Same as isend_irecv_overlap, but use memory that is allocated by MPI_Alloc_mem for the buffers. * typed_isend_irecv - Instead of copying the memory around, define a indexed MPI datatype and use that in the exchange. * gathered_type - Similar to typed_isend_irecv, but with minimal number of blocks in the indexed type, by tracking only contiguous blocks in the memory layout.
Instead of reading the style from a configuration script, it can also be directly set by the caller. If nothing is specified by the caller, the style will default to isend_irecv.
Usage:
commpattern = 'isend_irecv'
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_commPattern_type), | intent(out) | :: | me |
commpattern to set |
||
type(flu_State), | optional | :: | conf |
handle to the Lua script |
||
character(len=*), | intent(in), | optional | :: | style |
optional communication style |
subroutine tem_load_commPattern( me, conf, style ) ! -------------------------------------------------------------------- ! !> commpattern to set type(tem_commPattern_type), intent(out) :: me !> handle to the Lua script type(flu_State), optional :: conf !> optional communication style character(len=*), intent(in), optional :: style ! -------------------------------------------------------------------- ! integer :: iError ! -------------------------------------------------------------------- ! write(logUnit(1),*)"Loading communication pattern:" if (present(conf)) then ! If a configuration is given, this trumps any other setting. ! Defaults to isend_irecv. call aot_get_val( L = conf, & & key = 'commpattern', & & val = me%style, & & ErrCode = iError, & & default = 'isend_irecv' ) else if (present(style)) then ! If a style is given directly by the caller, use that one. me%style = style else ! Default to isend_irecv if nothing provided by the caller. me%style = 'isend_irecv' end if select case(trim(me%style)) case ('isend_irecv') me%exchange_long => comm_isend_irecv_long me%initbuf_long => tem_commbuf_long_fillpos me%finbuf_long => tem_commbuf_long_finpos me%exchange_int => comm_isend_irecv_int me%initbuf_int => tem_commbuf_int_fillpos me%finbuf_int => tem_commbuf_int_finpos me%exchange_real => comm_isend_irecv_real me%initbuf_real => tem_commbuf_real_fillpos me%finbuf_real => tem_commbuf_real_finpos case ('isend_irecv_overlap') me%exchange_long => comm_isend_irecv_overlap_long me%initbuf_long => tem_commbuf_long_fillpos me%finbuf_long => tem_commbuf_long_finpos me%exchange_int => comm_isend_irecv_overlap_int me%initbuf_int => tem_commbuf_int_fillpos me%finbuf_int => tem_commbuf_int_finpos me%exchange_real => comm_isend_irecv_overlap_real me%initbuf_real => tem_commbuf_real_fillpos me%finbuf_real => tem_commbuf_real_finpos case ('typed_isend_irecv') me%exchange_long => comm_typed_isend_irecv_long me%initbuf_long => tem_commbuf_long_fillindexed me%finbuf_long => tem_commbuf_long_fintyped me%exchange_int => comm_typed_isend_irecv_int me%initbuf_int => tem_commbuf_int_fillindexed me%finbuf_int => tem_commbuf_int_fintyped me%exchange_real => comm_typed_isend_irecv_real me%initbuf_real => tem_commbuf_real_fillindexed me%finbuf_real => tem_commbuf_real_fintyped case ('gathered_type') me%exchange_long => comm_typed_isend_irecv_long me%initbuf_long => tem_commbuf_long_gatherindexed me%finbuf_long => tem_commbuf_long_fintyped me%exchange_int => comm_typed_isend_irecv_int me%initbuf_int => tem_commbuf_int_gatherindexed me%finbuf_int => tem_commbuf_int_fintyped me%exchange_real => comm_typed_isend_irecv_real me%initbuf_real => tem_commbuf_real_gatherindexed me%finbuf_real => tem_commbuf_real_fintyped case ('isend_irecv_mpimem') me%exchange_long => comm_isend_irecv_long me%initbuf_long => tem_commbuf_long_fillmpimem me%finbuf_long => tem_commbuf_long_finmpimem me%exchange_int => comm_isend_irecv_int me%initbuf_int => tem_commbuf_int_fillmpimem me%finbuf_int => tem_commbuf_int_finmpimem me%exchange_real => comm_isend_irecv_real me%initbuf_real => tem_commbuf_real_fillmpimem me%finbuf_real => tem_commbuf_real_finmpimem case ('overlap_mpimem') me%exchange_long => comm_isend_irecv_overlap_long me%initbuf_long => tem_commbuf_long_fillmpimem me%finbuf_long => tem_commbuf_long_finmpimem me%exchange_int => comm_isend_irecv_overlap_int me%initbuf_int => tem_commbuf_int_fillmpimem me%finbuf_int => tem_commbuf_int_finmpimem me%exchange_real => comm_isend_irecv_overlap_real me%initbuf_real => tem_commbuf_real_fillmpimem me%finbuf_real => tem_commbuf_real_finmpimem case default write(logUnit(1),*) "ERROR, unknown commpattern: "//trim(me%style) write(logUnit(1),*) "available are: " write(logUnit(1),*) "* isend_irecv" write(logUnit(1),*) "* isend_irecv_overlap" write(logUnit(1),*) "* typed_isend_irecv" write(logUnit(1),*) "* gathered_type" write(logUnit(1),*) "* isend_irecv_mpimem" write(logUnit(1),*) "* overlap_mpimem" call tem_abort() end select write(logUnit(1),*) trim(me%style) end subroutine tem_load_commPattern