From b2ea759e0de02ed65369985536e3eba237c1d302 Mon Sep 17 00:00:00 2001 From: William Dawson Date: Fri, 24 Nov 2023 17:23:39 +0900 Subject: [PATCH] Some memory optimizations --- .../distributed_algebra_includes/MatrixMultiply.f90 | 13 +++++++++++-- .../FillMatrixFromTripletList.f90 | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Fortran/distributed_algebra_includes/MatrixMultiply.f90 b/Source/Fortran/distributed_algebra_includes/MatrixMultiply.f90 index afcc7b7b..86608339 100644 --- a/Source/Fortran/distributed_algebra_includes/MatrixMultiply.f90 +++ b/Source/Fortran/distributed_algebra_includes/MatrixMultiply.f90 @@ -103,9 +103,14 @@ & duplicate_offset_column * (JJ2 - 1)),& & AdjacentABlocks(II, JJ2)) END DO - !! Then Do A Local Gather + !! Then Do A Local Gather and Cleanup CALL ComposeMatrixColumns(AdjacentABlocks(II, :), & & LocalRowContribution(II)) + DO JJ2 = 1, & + & matAB%process_grid%number_of_blocks_columns / & + & matAB%process_grid%num_process_slices + CALL DestructMatrix(AdjacentABlocks(II, JJ2)) + END DO ATasks(II) = SendSizeA !$OMP END TASK CASE(SendSizeA) @@ -156,9 +161,13 @@ & duplicate_offset_row * (II2 - 1), JJ), & & TransposedBBlocks(II2, JJ)) END DO - !! Then Do A Local Gather + !! Then Do A Local Gather and Cleanup CALL ComposeMatrixColumns(TransposedBBlocks(:, JJ), & & LocalColumnContribution(JJ)) + DO II2 = 1, matAB%process_grid%number_of_blocks_rows / & + & matAB%process_grid%num_process_slices + CALL DestructMatrix(TransposedBBlocks(II2, JJ)) + END DO BTasks(JJ) = SendSizeB !$OMP END TASK CASE(SendSizeB) diff --git a/Source/Fortran/distributed_includes/FillMatrixFromTripletList.f90 b/Source/Fortran/distributed_includes/FillMatrixFromTripletList.f90 index 6151d02b..cb8f0d8c 100644 --- a/Source/Fortran/distributed_includes/FillMatrixFromTripletList.f90 +++ b/Source/Fortran/distributed_includes/FillMatrixFromTripletList.f90 @@ -46,4 +46,5 @@ END IF CALL DestructMatrix(local_matrix) + CALL DestructTripletList(shifted) CALL DestructTripletList(sorted_tlist)