[petsc-users] unable to distribute rows of a matrix across processors while loading
maitri ksh
maitri.ksh at gmail.com
Sun Aug 27 07:29:56 CDT 2023
Hi,
I am using MatSetSizes() followed by MatLoad() to distribute the rows of a
*sparse* matrix (*480000x480000*) across the processors. But it seems like
the entire matrix is getting loaded in each of the processors instead of
distributing it. What am I missing here?
*code snippet:*
Mat Js;
MatType type = MATMPIAIJ;
PetscViewer viewerJ;
PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD, "Js.dat",
FILE_MODE_READ, &viewerJ));
PetscCall(MatCreate(PETSC_COMM_WORLD, &Js));
PetscCall(MatSetSizes(Js, PETSC_DECIDE, PETSC_DECIDE, N, N));
PetscCall(MatSetType(Js, type));
PetscCall(MatLoad(Js, viewerJ));
PetscCall(PetscViewerDestroy(&viewerJ));
PetscCall(MatGetLocalSize(Js, &m, &n));
PetscCall(MatGetSize(Js, &M, &N));
PetscPrintf(PETSC_COMM_WORLD, "Js,Local rows: %d, Local columns: %d\n",
m, n);
*Output *of 'mpiexec -n 4 ./check':
Js,Local rows: 480000, Local columns: 480000
Js,Local rows: 480000, Local columns: 480000
Js,Local rows: 480000, Local columns: 480000
Js,Local rows: 480000, Local columns: 480000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230827/94ac8a95/attachment.html>
More information about the petsc-users
mailing list