Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Added intermediate local allocatable array to the coarray_collect met…
Browse files Browse the repository at this point in the history
…hods
  • Loading branch information
daminton committed May 11, 2023
1 parent 912b052 commit 704ce2d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/coarray/coarray_collect.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module subroutine coarray_component_collect_DP_arr1D(var,dest_img)
integer(I4B) :: i,img, ti, di, istart, iend, nmax
integer(I4B), allocatable :: n[:]
logical, allocatable :: isalloc[:]
real(DP), dimension(:), allocatable :: vari1

allocate(isalloc[*])
allocate(n[*])
Expand Down Expand Up @@ -55,7 +56,8 @@ module subroutine coarray_component_collect_DP_arr1D(var,dest_img)
if (this_image() == di) then
do img = 1, num_images()
if (img /= di) then
call util_append(var, tmp(1:n[img])[img])
allocate(vari1, source=tmp(1:n[img])[img])
call util_append(var, vari1)
n = n + n[img]
end if
end do
Expand Down Expand Up @@ -85,6 +87,7 @@ module subroutine coarray_component_collect_DP_arr2D(var,dest_img)
integer(I4B) :: i, img, ti, di, ntot, istart, iend, nmax
integer(I4B), allocatable :: n1[:], n2[:]
logical, allocatable :: isalloc[:]
real(DP), dimension(:,:), allocatable :: vari1

allocate(n1[*])
allocate(n2[*])
Expand Down Expand Up @@ -117,7 +120,8 @@ module subroutine coarray_component_collect_DP_arr2D(var,dest_img)
if (this_image() == di) then
do img = 1, num_images()
if (img /= di) then
call util_append(var, tmp(:,:)[img])
allocate(vari1,source=tmp(:,1:n2[img])[img])
call util_append(var, vari1)
n2 = n2 + n2[img]
end if
end do
Expand Down Expand Up @@ -219,6 +223,7 @@ module subroutine coarray_component_collect_I4B_arr1D(var,dest_img)
integer(I4B) :: i,img, ti, di, istart, iend, nmax
integer(I4B), allocatable :: n[:]
logical, allocatable :: isalloc[:]
integer(I4B), dimension(:), allocatable :: vari1

allocate(isalloc[*])
allocate(n[*])
Expand Down Expand Up @@ -247,7 +252,8 @@ module subroutine coarray_component_collect_I4B_arr1D(var,dest_img)
if (this_image() == di) then
do img = 1, num_images()
if (img /= di) then
call util_append(var, tmp(1:n[img])[img])
allocate(vari1, source=tmp(1:n[img])[img])
call util_append(var, vari1)
n = n + n[img]
end if
end do
Expand Down Expand Up @@ -277,6 +283,7 @@ module subroutine coarray_component_collect_lgt_arr1D(var,dest_img)
integer(I4B) :: i,img, ti, di, ntot, istart, iend, nmax
integer(I4B), allocatable :: n[:]
logical, allocatable :: isalloc[:]
logical, dimension(:), allocatable :: vari1

allocate(isalloc[*])
allocate(n[*])
Expand Down Expand Up @@ -305,7 +312,8 @@ module subroutine coarray_component_collect_lgt_arr1D(var,dest_img)
if (this_image() == di) then
do img = 1, num_images()
if (img /= di) then
call util_append(var, tmp(1:n[img])[img])
allocate(vari1, source=tmp(1:n[img])[img])
call util_append(var, vari1)
n = n + n[img]
end if
end do
Expand Down
4 changes: 3 additions & 1 deletion src/swiftest/swiftest_coarray.f90
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ module subroutine swiftest_coarray_component_collect_info_arr1D(var,dest_img)
integer(I4B) :: i,img, ti, di, ntot, istart, iend, nmax
integer(I4B), allocatable :: n[:]
logical, allocatable :: isalloc[:]
type(swiftest_particle_info), dimension(:), allocatable :: vari1

allocate(isalloc[*])
allocate(n[*])
Expand Down Expand Up @@ -538,7 +539,8 @@ module subroutine swiftest_coarray_component_collect_info_arr1D(var,dest_img)
if (this_image() == di) then
do img = 1, num_images()
if (img /= di) then
call util_append(var, tmp(1:n[img])[img])
allocate(vari1, source=tmp(1:n[img])[img])
call util_append(var, vari1)
n = n + n[img]
end if
end do
Expand Down

0 comments on commit 704ce2d

Please sign in to comment.