Skip to content

Commit

Permalink
(mpi) test failure fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Dec 20, 2024
1 parent 0ccbae3 commit ee1e177
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/mpi_dens.F90
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ subroutine get_mpitype_of_celldens(dtype)
call MPI_GET_ADDRESS(cell%apr,addr,mpierr)
disp(nblock) = addr - start

! padding must come last
nblock = nblock + 1
blens(nblock) = 8 - mod(4 * (6 + 2 * minpart) + 2*minpart, 8)
mpitypes(nblock) = MPI_INTEGER1
Expand Down
12 changes: 6 additions & 6 deletions src/main/mpi_force.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ module mpiforce
subroutine get_mpitype_of_cellforce(dtype)
#ifdef MPI
use mpi
use io, only:error
#endif
integer, intent(out) :: dtype
#ifdef MPI
Expand Down Expand Up @@ -212,15 +211,16 @@ subroutine get_mpitype_of_cellforce(dtype)
disp(nblock) = addr - start

nblock = nblock + 1
blens(nblock) = 8 - mod(nbytes_cellforce, 8)
blens(nblock) = size(cell%apr)
mpitypes(nblock) = MPI_INTEGER1
call MPI_GET_ADDRESS(cell%pad,addr,mpierr)
call MPI_GET_ADDRESS(cell%apr,addr,mpierr)
disp(nblock) = addr - start

! padding must come last
nblock = nblock + 1
blens(nblock) = size(cell%apr)
blens(nblock) = 8 - mod(nbytes_cellforce, 8)
mpitypes(nblock) = MPI_INTEGER1
call MPI_GET_ADDRESS(cell%apr,addr,mpierr)
call MPI_GET_ADDRESS(cell%pad,addr,mpierr)
disp(nblock) = addr - start

call MPI_TYPE_CREATE_STRUCT(nblock,blens(1:nblock),disp(1:nblock),mpitypes(1:nblock),dtype,mpierr)
Expand All @@ -229,7 +229,7 @@ subroutine get_mpitype_of_cellforce(dtype)
! check extent okay
call MPI_TYPE_GET_EXTENT(dtype,lb,extent,mpierr)
if (extent /= sizeof(cell)) then
call error('mpi_force','MPI_TYPE_GET_EXTENT has calculated the extent incorrectly')
call fatal('mpi_force','MPI_TYPE_GET_EXTENT has calculated the extent incorrectly')
endif

#else
Expand Down
2 changes: 2 additions & 0 deletions src/tests/test_mpi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ subroutine test_increase_mpi_memory(ntests,npass)
call checkval(force_stack_1%n,new_stacksize,0,nerr(1),'stacksize after mem increase')
call update_test_scores(ntests,nerr,npass)

nerr = 0
ncheck = 0
! Check cell data is the same as what was written into cells above
do i=1,new_stacksize
call checkvalbuf(force_stack_1%cells(i)%xpos(1),1.*i,1.e-15,'error in xpos(1) after mem increase',nerr(1),ncheck(1),maxerr(1))
Expand Down

0 comments on commit ee1e177

Please sign in to comment.