Create the primary subcommunicators
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ky_type), | intent(inout) | :: | self |
subroutine ky_make_subcom_1(self)
use mp, only: comm_type, split, free_comm, mp_undefined, sum_allreduce_sub
implicit none
class(ky_type), intent(inout) :: self
integer :: is, colour
type(comm_type) :: tmp
!/First make a subcommunicator involving any procs
!which can see this ky block
colour = 0
if(self%is_local) colour = 1
call sum_allreduce_sub(colour, self%parent_sub%id)
if ( colour == self%parent_sub%nproc) then
self%ky_sub_all=self%parent_sub
else
colour = mp_undefined
if(self%is_local) colour = 1
call split(colour,tmp,self%parent_sub%id)
!Note we only store the subcom for those procs which will use it
!this ensures an error will occur if we try to use the subcom in
!the wrong place
if(self%is_local)then
self%ky_sub_all=tmp
else
return
endif
endif
!Now make the supercell sub communicators
do is=1,self%nsupercell
!Set parent subcom
self%supercells(is)%parent_sub=self%ky_sub_all
!Now make child subcom
call self%supercells(is)%make_subcom_1
enddo
end subroutine ky_make_subcom_1