[petsc-users] 1D parallel split of dense matrix
Yann Jobic
yann.jobic at univ-amu.fr
Thu Sep 17 09:48:27 CDT 2020
Hi all,
I want to decompose a matrix in parallel for only one direction, the
columns, for a dense matrix, loaded from a binary file. I tried to use :
MatCreateDense(PETSC_COMM_WORLD,NumberOfRhs,matLocNbCols,NumberOfRhs,matNbCols,NULL,&NRhs);
with matLocNbCols the number of local columns of a linear system (matrix A).
However i've got an error when i use MatLoad : Read from file failed,
read past end of file.
Maybe because the number of local rows is equal to the number of global
ones (variable NumberOfRhs) ?
The sequential version runs fine.
Is it possible ?
I'm trying to set up a specific rhs matrix in order to solve the same
linear system (ksp) with different right hand sides (rhs).
In order to do so, i transposed the matrix containing all the rhs in a
file, which i would like to load in parallel. The idea is to use
MatGetRow, in order to create the rhs Vec, and then call KSPSolve (the
inverse matrix of A should have been kept).
However, i would like a particular setup (1D parallel split) for the
parallel layout of the rhs matrix : The number of columns of A is equal
to the number of column of the matrix rhs, and the number of rows of rhs
is equal to the number of rhs that i want to solve. I want this rhs to
be split in the same way of the linear system, and i want each
processors to have the whole global number of rows, that is to say, i
want a 1D decomposition of my rhs matrix (corresponding to MatCreateVecs).
I then have to copy a row of rhs in a vec, and solve, for all the rows
of rhs.
Is it a bad way to handle a N rhs problem with KSPSolve ?
Thanks,
Yann
ps : the error :
Reading ComplexMatrix.bin Matrix...
Matrix ComplexMatrix.bin read
global size of A matrix (583335,583335)
PROC : 1 Number of local columns of the matrix A : 291667
PROC : 1 Number of local columns of the vector : 291667
global size of NRhs Matrix : (15,583335)
PROC : 0 Number of local columns of the matrix A : 291668
PROC : 0 Number of local columns of the vector : 291668
Reading NRhs ComplexRhs.bin Matrix...
[0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Read from file failed
[0]PETSC ERROR: Read past end of file
More information about the petsc-users
mailing list