|
| 1 | +program teams_coarray_sendget |
| 2 | + use, intrinsic :: iso_fortran_env, only: team_type |
| 3 | + implicit none |
| 4 | + type(team_type) :: team |
| 5 | + integer, allocatable :: R_send(:,:)[:] |
| 6 | + integer :: extent, i, j, my_team, team_num_images, R_get[*] |
| 7 | + |
| 8 | + ! if there are an odd number of images, then even images have R(:,extent) == 0 |
| 9 | + extent = num_images()/2+mod(num_images(),2) |
| 10 | + allocate(R_send(extent, extent)[*], source=0) |
| 11 | + |
| 12 | + my_team = mod(this_image()-1,2)+1 |
| 13 | + |
| 14 | + form team (my_team, team) |
| 15 | + |
| 16 | + R_get = this_image() |
| 17 | + |
| 18 | + change team (team) |
| 19 | + team_num_images = num_images() |
| 20 | + do concurrent (i = 1:num_images(), j = 1:num_images()) |
| 21 | + R_send(this_image(),j)[i] = R_get[j] |
| 22 | + end do |
| 23 | + end team |
| 24 | + |
| 25 | + if (any(R_send /= reshape([((merge(i,0,i<=num_images() .and. j <= team_num_images), & |
| 26 | + i=my_team,2*extent,2),j=1,extent)], & |
| 27 | + shape=[extent,extent], order=[2,1]))) error stop 'Test failed.' |
| 28 | + |
| 29 | + sync all |
| 30 | + |
| 31 | + if (this_image() == 1) write(*,*) 'Test passed.' |
| 32 | +end program teams_coarray_sendget |
0 commit comments