Thanks. Than Than Thanks. On Sat, Jul 7, 2012 at 6:17 PM, Matthew Knepley <knepley at gmail.com> wrote:
> On Sat, Jul 7, 2012 at 11:08 AM, Xin Zhao <sean.null at gmail.com> wrote: > >> So if it is written as >> if PETSc.COMM_WORLD.get_Rank() == 0: >> L.setPreallocationNNZ((3,2)) >> >> will it achieve what I intend to do? >> > > No. No no no. You do not have to call setPreallocation(). That is why I > said (twice) that > the matrix is already preallocated. If something is "already > preallocated", it does not > have to be allocated again. > > Matt > > >> >> >> On Sat, Jul 7, 2012 at 6:04 PM, Matthew Knepley <knepley at gmail.com>wrote: >> >>> On Sat, Jul 7, 2012 at 11:02 AM, Xin Zhao <sean.null at gmail.com> wrote: >>> >>>> yeap...sorry... >>>> L=DA.createMat() >>>> >>>> then >>>> L.setPreallocationNNZ((3,2)) >>>> >>> >>> As I said, its already preallocated. >>> >>> Matt >>> >>> >>>> On Sat, Jul 7, 2012 at 6:01 PM, Matthew Knepley <knepley at >>>> gmail.com>wrote: >>>> >>>>> On Sat, Jul 7, 2012 at 10:58 AM, Xin Zhao <sean.null at gmail.com> wrote: >>>>> >>>>>> Dear all, >>>>>> >>>>>> I generate a matrix L by >>>>>> DA =PETSc.DA().create(...some...) >>>>>> L = DA.create() >>>>>> >>>>> >>>>> Is this createMatrix()? The matrix returned from a DA is already >>>>> preallocated. >>>>> >>>>> Matt >>>>> >>>>> >>>>>> Then I want to preallocate memory for L >>>>>> L.setPreallocationNNZ((3,2)) >>>>>> This works when for mpiexec -np 1 >>>>>> but it gives the error message below when mpiexec -np 4 >>>>>> >>>>>> [3] MatAnyAIJSetPreallocation() line 311 in >>>>>> petsc4py-1.2/src/include/custom.h >>>>>> [3] Operation done in wrong order >>>>>> [3] matrix is already preallocated >>>>>> >>>>>> How to solve this? >>>>>> >>>>>> Thanks in advance. >>>>>> >>>>>> Cheers, >>>>>> Xin >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> What most experimenters take for granted before they begin their >>>>> experiments is infinitely more interesting than any results to which their >>>>> experiments lead. >>>>> -- Norbert Wiener >>>>> >>>> >>>> >>> >>> >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to which their >>> experiments lead. >>> -- Norbert Wiener >>> >> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120707/755803d2/attachment.html>
