Thanks, Jed. So would you prefer to using MatCreateAIJ(?) or MatXAIJSetPreallocation(?)? I am having trouble to fill out the parameters. My local dense matrix is A(LDA, LDB). The global size of square matrix is N. What would be the parameters to use them?
I used MatCreateAIJ(PETSC_COMM_WORLD, LDA,LDB, N,N, d_nz, d_nnz,o_nz,o_nnz, &A); MatXAIJSetPreallocation(PETSC_COMM_WORLD, 1, d_nz, d_nnz,o_nz,o_nnz, &A); However, I have trouble to figure out the values for d_nz, d_nnz,o_nz, o_nnz since the local A is a block consisting of several sub-blocks from ScaLAPACK. I think MatCreateAIJ and MatXAIJSetPreallocation both take several rows together. Do you think it is still doable to preallocate A using either function? Jinquan From: petsc-users-bounces at mcs.anl.gov [mailto:[email protected]] On Behalf Of Jed Brown Sent: Wednesday, August 08, 2012 12:22 PM To: PETSc users list Subject: Re: [petsc-users] Customizeing MatSetValuesBlocked(...) On Wed, Aug 8, 2012 at 1:00 PM, Jinquan Zhong <jzhong at scsolutions.com<mailto:jzhong at scsolutions.com>> wrote: This makes sense to me. I thought the preallocation only applies to MatCreateMPIAIJwithArrays(?) and other more complicate functions. The matrix coming out from ScaLAPACK will be repopulated into a sparse matrix in a much large scale. I don't understand this exactly. You are taking the entries of the dense matrix and putting them into a much larger sparse matrix? In that case, you probably never need Elemental, but you definitely need to preallocate. Do I need to install elemental package in PETSc in order to use MATELEMENTAL? Yes, just configure petsc-dev with --download-elemental. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120808/02898269/attachment-0001.html>
