Skip to content

Commit

Permalink
bug fix when TFQMR halts
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyangzhuan committed Apr 4, 2024
1 parent 130beb0 commit 6b9a6b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SRC/BPACK_defs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ module BPACK_DEFS
! options for inversion
real(kind=8) tol_LS !< tolerance in pseudo inverse
real(kind=8) tol_Rdetect !< tolerance to detect numerical ranks
real(kind=8) tol_rand !< tolerance for randomized contruction
real(kind=8) tol_rand !< tolerance for randomized contruction, mostly used in matrix inversion
real(kind=8) jitter !< jittering for dense diagonal blocks
integer powiter !< order of power iteration in randomized LR
integer less_adapt !< 0 for rank adaptation for all BF levels, 1 for rank adaptation for the outtermost BF levels
Expand Down
8 changes: 8 additions & 0 deletions SRC/BPACK_solve_mul.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,14 @@ subroutine BPACK_Ztfqmr(precond, ntotal, nn_loc, b, x, err, iter, r0_initial, bm
we_local = dot_product(w, w)
call MPI_ALLREDUCE(we_local, we_sum, 1, MPI_DT, MPI_SUM, &
ptree%Comm, ierr)
if (ta<=1d-30) then
if (ptree%MyID == Main_ID) print *, 'Warning: TFQMR halts, returning now.'
err = rerr
iter = it
return
! write(32,*)'# ofiter,error:',it,rerr ! iterations file
end if

we = sqrt(abs(we_sum))/ta
cm = 1.0d0/sqrt(1.0d0 + we*we)
ta = ta*we*cm
Expand Down

0 comments on commit 6b9a6b5

Please sign in to comment.