Skip to content

Commit 162d2c2

Browse files
authored
Merge pull request #655 from mjberger/cleanUpBouss
clean up when to call resetBouss instead of every step, adding block coo option, adding petsc options to output timing file
2 parents 06315b9 + 99c701f commit 162d2c2

File tree

8 files changed

+1243
-76
lines changed

8 files changed

+1243
-76
lines changed

src/2d/bouss/Makefile.bouss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ COMMON_SOURCES += \
159159
$(BOUSSLIB)/buildSparseMatrixSGNcrs.f90 \
160160
$(BOUSSLIB)/prepBuildSparseMatrixSGNcoo.f90 \
161161
$(BOUSSLIB)/buildSparseMatrixSGNcoo.f90 \
162+
$(BOUSSLIB)/buildSparseMatrixSGNcoo_blocks.f90 \
162163
$(BOUSSLIB)/buildSparseMatrixMScoo.f90 \
163164
$(BOUSSLIB)/compressOut.f \
164165
$(BOUSSLIB)/matvec.f90 \

src/2d/bouss/amr2.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,6 @@ program amr2
860860
write(*,format_string)
861861
write(*,*)
862862
write(timing_unit,*)
863-
close(timing_unit)
864863

865864
if (isolver.eq. 2) then
866865
! if (countIterRef == 0) then
@@ -933,6 +932,7 @@ program amr2
933932
close(dbugunit)
934933

935934
#ifdef HAVE_PETSC
935+
call PetscViewerASCIIStdoutSetFileUnit(timing_unit,ierr)
936936
call PetscFinalize(ierr)
937937
#endif
938938

src/2d/bouss/bouss_module.f90

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module bouss_module
1919

2020
logical :: startWithBouss
2121

22-
logical :: crs
22+
logical :: crs, origCooFormat
2323

2424
real(kind=8) :: startBoussTime
2525

@@ -165,8 +165,17 @@ subroutine set_bouss(rest,time,naux)
165165
! using compressed row storage (CRS, also known as CSR or Yale) format:
166166
crs = .true.
167167
endif
168-
169-
! crs = .false. ! uncomment this line to force COO with SGN for testing
168+
! if crs is false this will force SGN to use triplet COO form
169+
! crs = .false.
170+
171+
! origCoo format ordered unknowns by all u updates then all v updates
172+
! block format is u and v together for a given cell. Better cache
173+
! performance, better for debugging and comparing with crs.
174+
! also reads into matlab for cond number testing, plotting,
175+
! so keeping around
176+
!origCooFormat = .false. ! set to false to use block format with coo
177+
! setting to avoid uninitialized var, but not used unless crs set to false
178+
origCooFormat = .true.
170179

171180
!------------------------------------------
172181
if (rest) then

src/2d/bouss/buildSparseMatrixSGNcoo.f90

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ subroutine buildSparseMatrixSGNcoo(q,qold,aux,soln,rhs, &
952952
! Need to add comments on SGN RHS.
953953

954954
if (debug) then
955-
write(67,*) '++b i,j,rhs = ',i,j,rhs(k_ij),rhs(k_ij + nD)
955+
write(67,*) '++before i,j,rhs = ',i,j,rhs(k_ij),rhs(k_ij + nD)
956956
endif
957957

958958
!RHS for SGN
@@ -976,20 +976,26 @@ subroutine buildSparseMatrixSGNcoo(q,qold,aux,soln,rhs, &
976976
+ 0.5d0*h_ij*wy + w(i,j)*etay)
977977

978978

979+
if (debug) then
980+
write(67,*) '++after i,j,rhs = ',i,j,rhs(k_ij),rhs(k_ij + nD)
981+
endif
982+
979983
if (debug) then
980984
write(44,998) nelt,nelt-neltSt
981985
998 format(" ending with nelt ",i6," used ",i5)
982986
endif
983987

984-
enddo
985-
enddo
986988

987-
if (debug .and. .false.) then ! dump matrix to look for singularity
988-
write(88,*)" level ",levelBouss
989+
if (debug) then ! dump matrix to look for singularity
990+
write(88,*)" triplets for i,j ",i,j," level ",levelBouss
989991
do k = neltBegin+1, nelt
990-
write(88,103) minfo_matrix_ia(k),minfo_matrix_ja(k),minfo_matrix_sa(k)
991-
103 format(2i8,e16.7)
992+
!write(88,103) minfo_matrix_ia(k),minfo_matrix_ja(k),minfo_matrix_sa(k)
993+
write(88,103) minfo_matrix_sa(k)
994+
!103 format(2i8,e16.7)
995+
103 format(e16.7)
992996
end do
997+
write(88,*)
998+
993999
!close(88)
9941000
!write(89,*)" level ",levelBouss
9951001
!do k = 1,2*numBoussCells
@@ -1000,6 +1006,9 @@ subroutine buildSparseMatrixSGNcoo(q,qold,aux,soln,rhs, &
10001006
!!stop
10011007
endif
10021008

1009+
enddo
1010+
enddo
1011+
10031012
if (debug) then
10041013
if (mptr .eq. 1) then
10051014
write(88,*)" grid ",mptr," level ",levelBouss,"x,y,ia,ja,sa"

0 commit comments

Comments
 (0)