-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b45cc
commit 1620c8e
Showing
6 changed files
with
87 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 17 additions & 17 deletions
34
Source/Fortran/distributed_algebra_includes/ScaleDiagonal.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
6 changes: 3 additions & 3 deletions
6
Source/Fortran/distributed_includes/GatherMatrixTripletList.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |