You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Such a module could export functionality through which parallel programs could switch parallel programming models at compile-time based on generic interfaces:
module parallelism_m
!! Use compile-time polymophism to select wrappers for native or alternative parallel progromming models
implicit none
private
public :: mpi_t ! alternative programming models
public :: error_stop_ ! execute error stop or print stop code, invoke MPI_Finalize, and invoke MPI_Abort
public :: co_broadcast_ ! call co_broadcast or MPI_Bcast
public :: co_sum_ ! call co_sum or MPI_Reduce
public :: co_min_ ! call co_min or MPI_Reduce
public :: co_max_ ! call co_max or MPI_Reduce
public :: co_reduce_ ! call co_reduce or MPI_Reduce
public :: init_ ! do nothing or invoke MPI_Init
public :: finalize_ ! do nothing or a invoke MPI_Finalize
public :: num_images_ ! invoke num_images() or call MPI_Comm_Size
public :: sync_all_ ! execute sync all or invoke MPI_Barrier
public :: stop_ ! execute stop or print stop code, invoke MPI_Finalize, and then execute stop
public :: this_image_ ! invoke this_image() or call MPI_Comm_Rank
type mpi_t
end type
interface error_stop_
module subroutine error_stop_native_integer(code)
implicit none
integer, intent(in) :: code
end subroutine
module subroutine error_stop_mpi_integer(mpi, code)
implicit none
type(mpi_t) mpi
integer, intent(in) :: code
end subroutine
module subroutine error_stop_native_character(code)
implicit none
character(len=*), intent(in) :: code
end subroutine
module subroutine error_stop_mpi_character(mpi, code)
implicit none
character(len=*), intent(in) :: code
end subroutine
end interface
interface init_
module subroutine init_native()
implicit none
end subroutine
module subroutine init_mpi(mpi)
implicit none
type(mpi_t) mpi
end subroutine
end interface
interface finalize_
module subroutine finalize_native()
implicit none
end subroutine
module subroutine finalize_mpi(mpi)
implicit none
type(mpi_t) mpi
end subroutine
end interface
interface this_image_
integer module function this_image_native()
implicit none
end function
integer module function this_image_mpi(mpi)
implicit none
type(mpi_t) mpi
end function
end interface
interface num_images_
integer module function num_images_native()
implicit none
end function
integer module function num_images_mpi(mpi)
implicit none
type(mpi_t) mpi
end function
end interface
! ...
end module parallelism_m
The text was updated successfully, but these errors were encountered:
@ktras I assume the MPI procedures are impure. In the Assert library, we can just not report the image on which an assertion fails so there won't be any need for this_image(). Otherwise, if we made the assertion subroutine impure, it would have a nasty domino effect across hundreds of procedures in multiple projects.
For this to be general, we would need to handle every combination of rank and intrinsic type, but I think if we just do ranks 0-2, it might suffice for present purposes. Handling derived type arguments for co_broadcast will be interesting.
@ktras I have a initial start on a draft of what we need in PR #85 with a comment containing a "To Do" item describing an issue that needs to be resolved. I'm hoping you can work on finishing the procedure definitions and fixing the issue described in the "To Do" section of the comment.
Such a module could export functionality through which parallel programs could switch parallel programming models at compile-time based on generic interfaces:
The text was updated successfully, but these errors were encountered: