subroutine shared_sync_mpi(win_shm, ierr)
integer(MPIArg):: win_shm
integer, intent(out), optional :: ierr
integer(MPIArg) :: ierr_, jerr, errorclass, length
character(len=255) :: string
character(*), parameter :: this_routine = 'shared_sync_mpi'
call mpi_win_sync(win_shm, ierr_)
if (present(ierr)) ierr = int(ierr_)
if (ierr_ /= MPI_SUCCESS) then
if (present(ierr)) then
return
else
call mpi_error_class(ierr_, errorclass, jerr)
call mpi_error_string(errorclass,string, length, jerr)
call stop_all(this_routine, string)
end if
endif
call mpi_barrier(mpi_comm_intra, ierr_)
if (present(ierr)) ierr = int(ierr_)
if (ierr_ /= MPI_SUCCESS) then
if (present(ierr)) then
return
else
call mpi_error_class(ierr_, errorclass, jerr)
call mpi_error_string(errorclass,string, length, jerr)
call stop_all(this_routine, string)
end if
endif
end subroutine shared_sync_mpi