From 1620c8e942e89b0e68df1a278d6dd8e7c3dcc470 Mon Sep 17 00:00:00 2001 From: William Dawson Date: Thu, 18 Apr 2024 17:56:52 +0900 Subject: [PATCH] lint --- Source/Fortran/FermiOperatorModule.F90 | 2 +- Source/Fortran/TripletListModule.F90 | 2 +- .../ScaleDiagonal.f90 | 34 +++--- .../GatherMatrixTripletList.f90 | 6 +- .../Fortran/sparse_includes/DiagonalScale.f90 | 16 +-- .../triplet_includes/GatherTripletList.f90 | 114 +++++++++--------- 6 files changed, 87 insertions(+), 87 deletions(-) diff --git a/Source/Fortran/FermiOperatorModule.F90 b/Source/Fortran/FermiOperatorModule.F90 index 9a4a2049..fafeb1c3 100644 --- a/Source/Fortran/FermiOperatorModule.F90 +++ b/Source/Fortran/FermiOperatorModule.F90 @@ -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 diff --git a/Source/Fortran/TripletListModule.F90 b/Source/Fortran/TripletListModule.F90 index c74f7ee3..5c967d2a 100644 --- a/Source/Fortran/TripletListModule.F90 +++ b/Source/Fortran/TripletListModule.F90 @@ -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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90 b/Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90 index 32492c14..01f7c66e 100644 --- a/Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90 +++ b/Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90 @@ -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) diff --git a/Source/Fortran/distributed_includes/GatherMatrixTripletList.f90 b/Source/Fortran/distributed_includes/GatherMatrixTripletList.f90 index f4fa0949..ecb280ff 100644 --- a/Source/Fortran/distributed_includes/GatherMatrixTripletList.f90 +++ b/Source/Fortran/distributed_includes/GatherMatrixTripletList.f90 @@ -1,3 +1,3 @@ -CALL GatherMatrixToProcess(this, lmat) -CALL MatrixToTripletList(lmat, tlist) -CALL DestructMatrix(lmat) \ No newline at end of file + CALL GatherMatrixToProcess(this, lmat) + CALL MatrixToTripletList(lmat, tlist) + CALL DestructMatrix(lmat) diff --git a/Source/Fortran/sparse_includes/DiagonalScale.f90 b/Source/Fortran/sparse_includes/DiagonalScale.f90 index c1997b5b..2bb20fae 100644 --- a/Source/Fortran/sparse_includes/DiagonalScale.f90 +++ b/Source/Fortran/sparse_includes/DiagonalScale.f90 @@ -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 diff --git a/Source/Fortran/triplet_includes/GatherTripletList.f90 b/Source/Fortran/triplet_includes/GatherTripletList.f90 index 2c19518f..9b1587df 100644 --- a/Source/Fortran/triplet_includes/GatherTripletList.f90 +++ b/Source/Fortran/triplet_includes/GatherTripletList.f90 @@ -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)