[petsc-users] converting scipy sparse CSR matrix to petcs matrix with mpi
John Travers
jtravs at gmail.com
Wed Aug 28 07:42:53 CDT 2013
Hi,
I currently generate PETSc matrices from scipy.sparse CSR format matrices as follows (where A is a scipy sparse CSR matrix):
pA = PETSc.Mat().createAIJ(size=A.shape, csr=(A.indptr, A.indices, A.data))
This work correctly on sequential runs, but if I run under MPI I get an error which I presume to be caused by the fact that all of my MPI processes try to simultaneously create this matrix, rather than splitting it? Eg. for 4 processes I get:
ValueError: size(I) is 32769, expected 8193
csr=(A.indptr, A.indices, A.data))
File "Mat.pyx", line 256, in petsc4py.PETSc.Mat.createAIJ (src/petsc4py.PETSc.c:82905)
What is the best/simplest/most efficient way to convert existing data in CSR format to a parallel sparse PETSc matrix for use by multiple MPI processes?
Thanks for your help!
John
More information about the petsc-users
mailing list