Il giorno mar 1 feb 2022 alle ore 18:34 Jed Brown <j...@jedbrown.org> ha scritto:
> Patrick Sanan <patrick.sa...@gmail.com> writes: > > > Am Di., 1. Feb. 2022 um 16:20 Uhr schrieb Jed Brown <j...@jedbrown.org>: > > > >> Patrick Sanan <patrick.sa...@gmail.com> writes: > >> > >> > Sorry about the delay on this. I can reproduce. > >> > > >> > This regression appears to be a result of this optimization: > >> > https://gitlab.com/petsc/petsc/-/merge_requests/4273 > >> > >> Thanks for tracking this down. Is there a reason to prefer preallocating > >> twice > >> > >> ierr = > >> MatPreallocatorPreallocate(preallocator,PETSC_TRUE,A);CHKERRQ(ierr); > >> ierr = > >> > MatPreallocatorPreallocate(preallocator,PETSC_TRUE,A_duplicate);CHKERRQ(ierr); > >> > >> versus using MatDuplicate() or MatConvert()? > >> > Jed this is not the point. Suppose you pass around only a preallocator, but do not pass around the matrices. Reusing the preallocator should be allowed. > > > Maybe if your preallocation is an overestimate for each of two different > > post-assembly non-zero structures in A and A_duplicate? > > Even then, why not preallocate A and duplicate immediately, before > compressing out zeros? > -- Stefano