Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
william-dawson committed Apr 18, 2024
1 parent f5b45cc commit 1620c8e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Source/Fortran/FermiOperatorModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ SUBROUTINE ComputeDenseFOE(H, ISQ, trace, K, inv_temp_in, &
! occ_temp = 0.5_NTREAL * (1.0_NTREAL - ERF(inv_temp * sval))
occ_temp = 1.0_NTREAL / (1.0_NTREAL + EXP(inv_temp * sval))
energy_value = energy_value + &
& occ_temp * tlist%DATA(II)%point_value
& occ_temp * tlist%DATA(II)%point_value
IF (occ_temp .LT. 0) THEN ! for safety
tlist%DATA(II)%point_value = 0
ELSE
Expand Down
2 changes: 1 addition & 1 deletion Source/Fortran/TripletListModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ SUBROUTINE CopyTripletList_rc(tripA, tripB)
tripB%DATA(II)%index_row = tripA%DATA(II)%index_row
tripB%DATA(II)%index_column = tripA%DATA(II)%index_column
tripB%DATA(II)%point_value = &
& CMPLX(tripA%DATA(II)%point_value, KIND=NTCOMPLEX)
& CMPLX(tripA%DATA(II)%point_value, KIND=NTCOMPLEX)
END DO
END SUBROUTINE CopyTripletList_rc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
34 changes: 17 additions & 17 deletions Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
INTEGER :: II, col
INTEGER :: II, col

!! Merge to the local block
CALL MergeMatrixLocalBlocks(this, lmat)
!! Merge to the local block
CALL MergeMatrixLocalBlocks(this, lmat)

!! Filter out the triplets that aren't stored locally
CALL ConstructTripletList(filtered)
DO II = 1, tlist%CurrentSize
CALL GetTripletAt(tlist, II, trip)
col = trip%index_column
IF (col .GE. this%start_column .AND. col .LT. this%end_column) THEN
!! Filter out the triplets that aren't stored locally
CALL ConstructTripletList(filtered)
DO II = 1, tlist%CurrentSize
CALL GetTripletAt(tlist, II, trip)
col = trip%index_column
IF (col .GE. this%start_column .AND. col .LT. this%end_column) THEN
trip%index_column = trip%index_column - this%start_column + 1
trip%index_row = trip%index_column
CALL AppendToTripletList(filtered, trip)
END IF
END DO
END IF
END DO

!! Scale
CALL MatrixDiagonalScale(lmat, filtered)
!! Scale
CALL MatrixDiagonalScale(lmat, filtered)

!! Split
CALL SplitMatrixToLocalBlocks(this, lmat)
CALL DestructMatrix(lmat)
CALL DestructTripletList(filtered)
!! Split
CALL SplitMatrixToLocalBlocks(this, lmat)
CALL DestructMatrix(lmat)
CALL DestructTripletList(filtered)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CALL GatherMatrixToProcess(this, lmat)
CALL MatrixToTripletList(lmat, tlist)
CALL DestructMatrix(lmat)
CALL GatherMatrixToProcess(this, lmat)
CALL MatrixToTripletList(lmat, tlist)
CALL DestructMatrix(lmat)
16 changes: 8 additions & 8 deletions Source/Fortran/sparse_includes/DiagonalScale.f90
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

INTEGER :: col, II

INTEGER :: col, II

DO II = 1, tlist%CurrentSize
col = tlist%DATA(II)%index_column
val = tlist%DATA(II)%point_value
mat%values(mat%outer_index(col) + 1:mat%outer_index(col + 1)) = &
val * mat%values(mat%outer_index(col) + 1:mat%outer_index(col + 1))
END DO
DO II = 1, tlist%CurrentSize
col = tlist%DATA(II)%index_column
val = tlist%DATA(II)%point_value
mat%values(mat%outer_index(col) + 1:mat%outer_index(col + 1)) = &
val * mat%values(mat%outer_index(col) + 1:mat%outer_index(col + 1))
END DO
114 changes: 57 additions & 57 deletions Source/Fortran/triplet_includes/GatherTripletList.f90
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
!! Local Data - Send/Recv Buffers
INTEGER, DIMENSION(:), ALLOCATABLE :: send_buffer_row
INTEGER, DIMENSION(:), ALLOCATABLE :: send_buffer_col
INTEGER, DIMENSION(:), ALLOCATABLE :: recv_buffer_row
INTEGER, DIMENSION(:), ALLOCATABLE :: recv_buffer_col
!! Local Data - Send/Recv Buffers
INTEGER, DIMENSION(:), ALLOCATABLE :: send_buffer_row
INTEGER, DIMENSION(:), ALLOCATABLE :: send_buffer_col
INTEGER, DIMENSION(:), ALLOCATABLE :: recv_buffer_row
INTEGER, DIMENSION(:), ALLOCATABLE :: recv_buffer_col

!! Sizes help
INTEGER, DIMENSION(:), ALLOCATABLE :: recvcounts
INTEGER, DIMENSION(:), ALLOCATABLE :: displ
INTEGER :: gather_size
!! Sizes help
INTEGER, DIMENSION(:), ALLOCATABLE :: recvcounts
INTEGER, DIMENSION(:), ALLOCATABLE :: displ
INTEGER :: gather_size

!! Temporary variables
INTEGER :: num_processes, II, ierr
!! Temporary variables
INTEGER :: num_processes, II, ierr

!! Figure out the comm size
CALL MPI_COMM_SIZE(comm, num_processes, ierr)
!! Figure out the comm size
CALL MPI_COMM_SIZE(comm, num_processes, ierr)

!! Get the count
ALLOCATE(recvcounts(num_processes))
CALL MPI_Allgather(triplet_in%CurrentSize, 1, MPI_INTEGER, recvcounts, &
& 1, MPI_INTEGER, comm, ierr)
!! Get the count
ALLOCATE(recvcounts(num_processes))
CALL MPI_Allgather(triplet_in%CurrentSize, 1, MPI_INTEGER, recvcounts, &
& 1, MPI_INTEGER, comm, ierr)

!! Get the displacements
gather_size = SUM(recvcounts)
ALLOCATE(displ(num_processes))
displ(1) = 0
DO II = 2, num_processes
displ(II) = displ(II - 1) + recvcounts(II - 1)
END DO
!! Get the displacements
gather_size = SUM(recvcounts)
ALLOCATE(displ(num_processes))
displ(1) = 0
DO II = 2, num_processes
displ(II) = displ(II - 1) + recvcounts(II - 1)
END DO

!! Prepare the send buffers
ALLOCATE(send_buffer_row(triplet_in%CurrentSize))
ALLOCATE(send_buffer_col(triplet_in%CurrentSize))
ALLOCATE(send_buffer_val(triplet_in%CurrentSize))
DO II = 1, triplet_in%CurrentSize
CALL GetTripletAt(triplet_in, II, temp_triplet)
send_buffer_row(II) = temp_triplet%index_row
send_buffer_col(II) = temp_triplet%index_column
send_buffer_val(II) = temp_triplet%point_value
END DO
!! Prepare the send buffers
ALLOCATE(send_buffer_row(triplet_in%CurrentSize))
ALLOCATE(send_buffer_col(triplet_in%CurrentSize))
ALLOCATE(send_buffer_val(triplet_in%CurrentSize))
DO II = 1, triplet_in%CurrentSize
CALL GetTripletAt(triplet_in, II, temp_triplet)
send_buffer_row(II) = temp_triplet%index_row
send_buffer_col(II) = temp_triplet%index_column
send_buffer_val(II) = temp_triplet%point_value
END DO

!! Gather Call
ALLOCATE(recv_buffer_row(gather_size))
ALLOCATE(recv_buffer_col(gather_size))
ALLOCATE(recv_buffer_val(gather_size))
CALL MPI_Allgatherv(send_buffer_row, triplet_in%CurrentSize, MPI_INTEGER, &
& recv_buffer_row, recvcounts, displ, MPI_INTEGER, comm, ierr)
CALL MPI_Allgatherv(send_buffer_col, triplet_in%CurrentSize, MPI_INTEGER, &
& recv_buffer_col, recvcounts, displ, MPI_INTEGER, comm, ierr)
CALL MPI_Allgatherv(send_buffer_val, triplet_in%CurrentSize, MPIDATATYPE, &
& recv_buffer_val, recvcounts, displ, MPIDATATYPE, comm, ierr)
!! Gather Call
ALLOCATE(recv_buffer_row(gather_size))
ALLOCATE(recv_buffer_col(gather_size))
ALLOCATE(recv_buffer_val(gather_size))
CALL MPI_Allgatherv(send_buffer_row, triplet_in%CurrentSize, MPI_INTEGER, &
& recv_buffer_row, recvcounts, displ, MPI_INTEGER, comm, ierr)
CALL MPI_Allgatherv(send_buffer_col, triplet_in%CurrentSize, MPI_INTEGER, &
& recv_buffer_col, recvcounts, displ, MPI_INTEGER, comm, ierr)
CALL MPI_Allgatherv(send_buffer_val, triplet_in%CurrentSize, MPIDATATYPE, &
& recv_buffer_val, recvcounts, displ, MPIDATATYPE, comm, ierr)

!! Unpack
CALL ConstructTripletList(gathered_out, gather_size)
DO II = 1, gather_size
gathered_out%DATA(II)%index_row = recv_buffer_row(II)
gathered_out%DATA(II)%index_column = recv_buffer_col(II)
gathered_out%DATA(II)%point_value = recv_buffer_val(II)
END DO
!! Unpack
CALL ConstructTripletList(gathered_out, gather_size)
DO II = 1, gather_size
gathered_out%DATA(II)%index_row = recv_buffer_row(II)
gathered_out%DATA(II)%index_column = recv_buffer_col(II)
gathered_out%DATA(II)%point_value = recv_buffer_val(II)
END DO

!! Cleanup
DEALLOCATE(recvcounts)
DEALLOCATE(displ)
DEALLOCATE(send_buffer_row)
DEALLOCATE(send_buffer_col)
DEALLOCATE(send_buffer_val)
!! Cleanup
DEALLOCATE(recvcounts)
DEALLOCATE(displ)
DEALLOCATE(send_buffer_row)
DEALLOCATE(send_buffer_col)
DEALLOCATE(send_buffer_val)

0 comments on commit 1620c8e

Please sign in to comment.