Note that PETSc's formats are more space-efficient and faster than the COO (triplet) format. If you can produce triplet chunks instead of the full matrix, you can add them incrementally to reduce the peak memory usage. Note that many preconditioners use storage similar to (or greater than) a single assembled matrix, so copying (which is done before preconditioner setup) may not increase the peak memory usage (which is all that matters for capability).
"Smith, Barry F. via petsc-users" <[email protected]> writes: > Since PETSc does not use that format there, of course, has to be a time > when you have duplicate memory. > > Barry > > > > > >> On Jan 9, 2020, at 12:47 PM, Sam Guo <[email protected]> wrote: >> >> Dear PETSc dev team, >> Suppose I have the matrix already in triplet format int int[] I, int[] J, >> double[] A, Is possible to create petsc matrix using A without copying? I >> like to avoid the duplicate memory if possible. >> >> Thanks, >> Sam
