A Module For Performing Distributed Sparse Matrix Operations.
Construct an empty sparse, distributed, matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to be constructed. |
||
integer, | intent(in) | :: | matrix_dim_ | The dimension of the full matrix. |
||
type(ProcessGrid_t), | intent(in), | optional | TARGET | :: | process_grid_in | A process grid to host the matrix. |
logical, | intent(in), | optional | :: | is_complex_in | True if you want to use complex numbers. |
Construct an empty sparse, distributed, matrix using another matrix to determine the parameters. Note that no data is copied, the matrix will be empty.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to be constructed. |
||
type(Matrix_ps), | intent(in) | :: | reference_matrix | The reference matrix to take parameters from. |
Destruct a distributed sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to destruct. |
Construct distributed sparse matrix from a matrix market file in parallel. Read \cite boisvert1996matrix for the details.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The file being constructed. |
||
character(len=*), | intent(in) | :: | file_name | The name of the file to read. |
||
type(ProcessGrid_t), | intent(in), | optional | :: | process_grid_in | Grid to distribute the matrix on. |
Construct a distributed sparse matrix from a binary file in parallel. Faster than text, so this is good for check pointing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The file being constructed. |
||
character(len=*), | intent(in) | :: | file_name | The name of the file to read. |
||
type(ProcessGrid_t), | intent(in), | optional | :: | process_grid_in | Grid to distribute the matrix on. |
Write a distributed sparse matrix to a matrix market file. Read \cite boisvert1996matrix for the details.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The Matrix to write. |
||
character(len=*), | intent(in) | :: | file_name | The name of the file to write to. |
Save a distributed sparse matrix to a binary file. Faster than text, so this is good for check pointing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The Matrix to write. |
||
character(len=*), | intent(in) | :: | file_name | The name of the file to write to. |
This routine fills in a matrix based on local triplet lists. Each process should pass in triplet lists with global coordinates. It does not matter where each triplet is stored, as long as global coordinates are given. However, if you explicitly set prepartitioned_in to True, all data must be on the correct process. In that case, there is no communication required.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps) | :: | this | The matrix to fill. |
|||
type(TripletList_r) | :: | triplet_list | The triplet list of values. |
|||
logical, | intent(in), | optional | :: | preduplicated_in | If lists are preduplicated across slices set this to true. |
|
logical, | intent(in), | optional | :: | prepartitioned_in | If all lists only contain local matrix elements set this to true. |
This routine fills in a matrix based on local triplet lists. Each process should pass in triplet lists with global coordinates. It does not matter where each triplet is stored, as long as global coordinates are given. However, if you explicitly set prepartitioned_in to True, all data must be on the correct process. In that case, there is no communication required.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps) | :: | this | The matrix to fill. |
|||
type(TripletList_c) | :: | triplet_list | The triplet list of values. |
|||
logical, | intent(in), | optional | :: | preduplicated_in | If lists are preduplicated across slices set this to true. |
|
logical, | intent(in), | optional | :: | prepartitioned_in | If all lists only contain local matrix elements set this to true. |
Fill in the values of a distributed matrix with the identity matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix being filled. |
Fill in the values of a distributed matrix with a permutation. If you do not specify permuterows, will default to permuting rows.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix being filled. |
||
integer, | intent(in), | DIMENSION(:) | :: | permutation_vector | Describes for each row/column, where it goes. |
|
logical, | intent(in), | optional | :: | permute_rows_in | If true permute rows, false permute columns. |
Get the actual dimension of the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The matrix. |
Dimension of the matrix
Get the logical dimension of the matrix. Includes padding.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The matrix. |
Dimension of the matrix
Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix. |
||
type(TripletList_r), | intent(inout) | :: | triplet_list | The list to fill. |
Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix. |
||
type(TripletList_c), | intent(inout) | :: | triplet_list | The list to fill. |
Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetMatrixTripletList, because communication is required Data is returned with absolute coordinates.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix. |
||
type(TripletList_r), | intent(inout) | :: | triplet_list | The list to fill. |
||
integer | :: | start_row | The starting row for data to store on this process. |
|||
integer | :: | end_row | The ending row for data to store on this process. |
|||
integer | :: | start_column | The starting col for data to store on this process |
|||
integer | :: | end_column | The ending col for data to store on this process |
Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetMatrixTripletList, because communication is required Data is returned with absolute coordinates.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix. |
||
type(TripletList_c), | intent(inout) | :: | triplet_list | The list to fill. |
||
integer | :: | start_row | The starting row for data to store on this process. |
|||
integer | :: | end_row | The ending row for data to store on this process. |
|||
integer | :: | start_column | The starting col for data to store on this process |
|||
integer | :: | end_column | The ending col for data to store on this process |
Print out a distributed sparse matrix. This is a serial print routine, and should probably only be used for debug purposes.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps) | :: | this | The matrix to print. |
|||
character(len=*), | intent(in), | optional | :: | file_name_in | Optionally, you can pass a file to print to instead of the console. |
Print out information about a distributed sparse matrix. Sparsity, and load balancing information.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | This the matrix to print information about. |
Get a measure of how load balanced this matrix is. For each process, the number of non-zero entries is calculated. Then, this function returns the max and min of those values.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The matrix to compute the measure on. |
||
integer, | intent(out) | :: | min_size | The minimum entries contained on a single process. |
||
integer, | intent(out) | :: | max_size | The maximum entries contained on a single process. |
Get the total number of non-zero entries in the distributed sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The matrix to calculate the number of non-zero entries of. |
The number of non-zero entries in the matrix.
A utility routine that filters a sparse matrix. All (absolute) values below the threshold are set to zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to filter. |
||
real(kind=NTREAL), | intent(in) | :: | threshold | Threshold (absolute) values below this are filtered |
Merge together the local matrix blocks into one big matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix to merge from. |
||
type(Matrix_lsr), | intent(inout) | :: | merged_matrix | The merged matrix. |
Merge together the local matrix blocks into one big matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix to merge from. |
||
type(Matrix_lsc), | intent(inout) | :: | merged_matrix | The merged matrix. |
Take a local matrix, and use it to fill the local block matrix structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The distributed sparse matrix to split into. |
||
type(Matrix_lsr), | intent(in) | :: | matrix_to_split | The matrix to split up. |
Take a local matrix, and use it to fill the local block matrix structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The distributed sparse matrix to split into. |
||
type(Matrix_lsc), | intent(in) | :: | matrix_to_split | The matrix to split up. |
Transpose a sparse matrix. Note that this is a pure transpose, there is no complex conjugate performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | AMat | The matrix to transpose. |
||
type(Matrix_ps), | intent(out) | :: | TransMat | TransMat = A^T . |
Every value in the matrix is changed into its complex conjugate.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to compute the complex conjugate of. |
Split the current communicator, and give each group a complete copy of this
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to split. |
||
type(Matrix_ps), | intent(inout) | :: | split_mat | A copy of the matrix hosted on a small process grid. |
||
integer, | intent(out) | :: | my_color | Distinguishes between the two groups. |
||
logical, | intent(out) | :: | split_slice | If we split along the slice direction, this is True |
This subroutine gathers the entire matrix into a local matrix on the given process. The process id is a within_slice id, so the data will still be replicated across slices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to gather. |
||
type(Matrix_lsr), | intent(inout) | :: | local_mat | The full matrix, stored in a local matrix. |
||
integer, | intent(in) | :: | within_slice_id | Which process to gather on. |
This subroutine gathers the entire matrix into a local matrix on to every process.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to gather. |
||
type(Matrix_lsr), | intent(inout) | :: | local_mat | The full matrix, stored in a local matrix. |
This subroutine gathers the entire matrix into a local matrix on the given process. The process id is a within_slice id, so the data will still be replicated across slices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to gather. |
||
type(Matrix_lsc), | intent(inout) | :: | local_mat | The full matrix, stored in a local matrix. |
||
integer, | intent(in) | :: | within_slice_id | Which process to gather on. |
This subroutine gathers the entire matrix into a local matrix on to every process.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to gather. |
||
type(Matrix_lsc), | intent(inout) | :: | local_mat | The full matrix, stored in a local matrix. |
A datatype for a distributed blocked CSR matrix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | logical_matrix_dimension | Number of matrix rows/columns for full matrix, scaled for process grid. |
|||
integer, | public | :: | actual_matrix_dimension | Number of matrix rows/columns for the full matrix, unscaled. |
|||
type(Matrix_lsr), | public, | DIMENSION(:,:), ALLOCATABLE | :: | local_data_r | A 2D array of local CSR matrices. |
||
type(Matrix_lsc), | public, | DIMENSION(:,:), ALLOCATABLE | :: | local_data_c | A 2D array of local CSC matrices. |
||
integer, | public | :: | start_column | first column stored locally. |
|||
integer, | public | :: | end_column | last column stored locally is less than this. |
|||
integer, | public | :: | start_row | first row stored locally. |
|||
integer, | public | :: | end_row | last row stored locally is less than this. |
|||
integer, | public | :: | local_columns | number of local columns. |
|||
integer, | public | :: | local_rows | number of local rows. |
|||
type(ProcessGrid_t), | public, | POINTER | :: | process_grid | process grid to operate on |
||
logical, | public | :: | is_complex | true if the matrix data is true. |
When you want to change the process grid of a matrix, you can call this routine with the new process grid value. Data will be automatically redistributed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to set the grid of. |
||
type(ProcessGrid_t), | intent(in) | :: | grid | The grid to set it to. |
Copy an arbitrary slice from a matrix into a new smaller matrix. NTPoly only works with square matrices, so if the number of rows and columns is different the matrix is resized to the maximum size.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(in) | :: | this | The distributed sparse matrix. |
||
type(Matrix_ps), | intent(inout) | :: | submatrix | The slice to fill. |
||
integer | :: | start_row | The starting row to include in this matrix. |
|||
integer | :: | end_row | The ending row to include in this matrix. |
|||
integer | :: | start_column | The starting column to include in this matrix. |
|||
integer | :: | end_column | The last column to include in this matrix. |
Change the size of a matrix. If the new size is smaller, then values outside that range are deleted. IF the new size is bigger, zero padding is applied. Warning: this requires a full data redistribution.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ps), | intent(inout) | :: | this | The matrix to resize. |
||
integer, | intent(in) | :: | new_size | The new size of the matrix. |