Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1 optional MPI_INIT_THREAD for multithreaded MPI applications

Unstable (example)
closed
nobody
5
2013-12-02
2013-01-02
Anonymous
No

This adds a the Makefile-Option MPI_THREADED to enable the use of MPI_INIT_THREAD() instead of MPI_INIT().

It adds two optional parameters to
#if defined(USE_MPI_THREADED)
subroutine pFUnit_Init(thread_required, thread_provided)
use MpiServer_mod, only: amMpiServer
integer, intent(in), optional :: thread_required
integer, intent(out), optional:: thread_provided
integer :: thread_req, thread_prov
#else
subroutine pFUnit_Init()
use MpiServer_mod, only: amMpiServer
#endif

and to
#if defined(USE_MPI_THREADED)
subroutine runMpiServer(thread_required, thread_provided)
use IO_Utilities_mod
integer, intent(in), optional :: thread_required
integer, intent(out), optional:: thread_provided
integer :: thread_req, thread_prov
#else
subroutine runMpiServer()
use IO_Utilities_mod
#endif

Discussion


  • Anonymous
    2013-01-02

    I am unable to add the patch. sourforge is currently unable to add file, sorry.
    Error: File upload: ArtifactFile: Could not open file for writing

     

  • Anonymous
    2013-01-02

    !---------------------------------------------------------------------------
    !> Launches the MPI server using the MPI mechanism.
    !---------------------------------------------------------------------------
    #if defined(USE_MPI_THREADED)
    subroutine runMpiServer(thread_required, thread_provided)
    use IO_Utilities_mod
    integer, intent(in), optional :: thread_required
    integer, intent(out), optional:: thread_provided
    integer :: thread_req, thread_prov
    #else
    subroutine runMpiServer()
    use IO_Utilities_mod
    #endif
    include 'mpif.h'
    type (MpiServer_type) :: this
    integer :: ier

    #if defined(USE_MPI_THREADED)
    if(.not.present(thread_required)) then
    thread_req = MPI_THREAD_SINGLE
    else
    thread_req = thread_required
    end if
    call mpi_init_thread(thread_req, thread_prov, ier)
    if(present(thread_provided)) then
    thread_provided = thread_prov
    end if
    #else
    call mpi_init(ier)
    #endif

    print*,'ping' ! signal am alive
    this = MpiServer()
    call beginPolling(this)

    call terminate(this)
    call clean(this)

    call Mpi_Finalize(ier)
    end subroutine runMpiServer

     

  • Anonymous
    2013-01-02

    !---------------------------------------------------------------------------
    !> Initializes pFUnit when using MPI only for MPI initialization. Placing
    !! a call to this routine at the top of main enables the executable to
    !! invoke itself. This turn enables pFunit to launch MPI-based tests.
    !---------------------------------------------------------------------------
    #if defined(USE_MPI_THREADED)
    subroutine pFUnit_Init(thread_required, thread_provided)
    use MpiServer_mod, only: amMpiServer
    integer, intent(in), optional :: thread_required
    integer, intent(out), optional:: thread_provided
    integer :: thread_req, thread_prov
    #else
    subroutine pFUnit_Init()
    use MpiServer_mod, only: amMpiServer
    #endif
    #if defined(USE_MPI) | defined(USE_ESMF)
    include 'mpif.h'
    integer :: ier
    if (amMpiServer()) then
    !----------------------------------------------------------------
    ! I should be an mpi session execd by the primary executable
    !----------------------------------------------------------------
    #if defined(USE_MPI_THREADED)
    if(.not.present(thread_required)) then
    thread_req = MPI_THREAD_SINGLE
    else
    thread_req = thread_required
    end if
    call runMpiServer(thread_req, thread_prov)
    if(present(thread_provided)) then
    thread_provided = thread_prov
    end if
    #else
    call runMpiServer()
    #endif
    stop
    else if (isNewMpiDriver()) then
    #ifdef USE_ESMF
    call esmf_initialize()
    #else

    #if defined(USE_MPI_THREADED)
    if(.not.present(thread_required)) then
    thread_req = MPI_THREAD_SINGLE
    else
    thread_req = thread_required
    end if
    call mpi_init_thread(thread_req, thread_prov, ier)
    if(present(thread_provided)) then
    thread_provided = thread_prov
    end if
    #else
    call mpi_init(ier)
    #endif

    #endif

    return
    else ! top-level process
    return
    end if
    #endif

    end subroutine pFUnit_Init

     
    • We're catching up on our backlog and have been working with pFUnit 2.0 which has a different MPI server scheme. Have you moved to pFUnit 2.0? If not, we might be able to put your modification into our legacy pFUnit... If you have moved to 2.0, does the new scheme meet your needs? I'd like to find out what the current situation is before we work this into 2.0.

       
  • Tom Clune
    Tom Clune
    2013-03-31

    Hmm. I never received a notification of this patch. (I don't use sourceforge often enough to know all the bells and whistles.)

    I certainly would like to enable your changes. I hope to release pfunit 2.0 in the very near future and will attempt to include your suggestion at that time.

     
  • We're catching up on our backlog and have been working with pFUnit 2.0 which has a different MPI server scheme. Have you moved to pFUnit 2.0? If not, we might be able to put your modification into our legacy pFUnit... If you have moved to 2.0, does the new scheme meet your needs? I'd like to find out what the current situation is before we work this into 2.0.

     
  • This request seems stale… Please let us know if this patch/feature is still relevant. Otherwise we will close this request on 2013-1130.

     
  • If interest or a need is demonstrated, we may reopen this ticket, which seems to be for version 1.

     
    • labels: --> AbandonedStale, Version1, MPI, threads
    • status: open --> closed
    • Group: --> Unstable (example)