Skip to content

Commit

Permalink
Finish off allgatherv tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bhourahine committed Nov 7, 2020
1 parent a014bfb commit f477589
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ foreach(target IN LISTS tested)
${MPIEXEC_POSTFLAGS}
)
set_tests_properties(${target} PROPERTIES
# test cases generate this on stdOut
PASS_REGULAR_EXPRESSION "TestPASSED"
)
set_tests_properties(${target} PROPERTIES
# test cases generate this on stdOut
FAIL_REGULAR_EXPRESSION "TestFAILED"
)
endforeach()
23 changes: 19 additions & 4 deletions test/test_allgatherv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ program test_allgatherv
if (mycomm%rank == mycomm%size - 1) then
write(*, *) "Recv1 buffer:", recv1
end if
iCount = 0
do ii = 1, mycomm%size
iCount = iCount + ii**2
end do
! test what has been gathered
iCount = (2*mycomm%size**3+3*mycomm%size**2+mycomm%size)/6
if (nint(sum(recv1)) /= iCount) then
tPassed = .false.
else
tPassed = .true.
end if
tPassed = tPassed .and. (abs(sum(recv1)-nint(sum(recv1))) < epsilon(1.0_sp))
call testReturn(mycomm, tPassed)
deallocate(recvcounts)
deallocate(recv1)
Expand Down Expand Up @@ -73,6 +72,14 @@ program test_allgatherv
write(*,*)recv2(:,ii)
end do
end if
iCount = 5*mycomm%size*(mycomm%size+1)*(2*mycomm%size+1)/6
if (nint(sum(recv2)) /= iCount) then
tPassed = .false.
else
tPassed = .true.
end if
tPassed = tPassed .and. (abs(sum(recv2)-nint(sum(recv2))) < epsilon(1.0_sp))
call testReturn(mycomm, tPassed)
deallocate(recvcounts)


Expand All @@ -95,6 +102,14 @@ program test_allgatherv
if (mycomm%rank == mycomm%size - 1) then
write(*, *) "Recv1 buffer:", recv1
end if
! test what has been gathered
if (nint(sum(recv1)) /= (mycomm%size*(mycomm%size+1))/2) then
tPassed = .false.
else
tPassed = .true.
end if
tPassed = tPassed .and. (abs(sum(recv1)-nint(sum(recv1))) < epsilon(1.0_sp))
call testReturn(mycomm, tPassed)

call mpifx_finalize()

Expand Down

0 comments on commit f477589

Please sign in to comment.