Research Article

Using Coarrays to Parallelize Legacy Fortran Applications: Strategy and Case Study

Listing 7

Unoptimized collective sum routine.
subroutine vector_co_sum_serial(vector)
real(rkind), intent(inout)  :: vector(:)[*]
integer image
sync all
if (this_image() == 1) then
  do image = 2, num_images()
   vector(:)1 = vector(:)1 + vector(:)[image]
  end do
end if
sync all
if (this_image()/ = 1) vector(:) = vector(:)1
sync all
end subroutine