Ahh yes, a million times better (for appropriately sized P). Thanks
> On Feb 14, 2017, at 9:18 PM, Jed Brown <[email protected]> wrote: > > Barry Smith <[email protected]> writes: > >> Here you go. In 20+ years of PETSc no one has needed this before. > > This is disgusting O(P) critical path. Do it in O(log P): > > int mysum=0,mystart; > for (i=0; i<nlocal; i++) { > mysum += xx[i]; > } > MPI_Scan(&mysum,&mystart,1,MPI_INT,MPI_SUM,comm); > mystart -= mysum; > xx[0] += mystart; > for (i=1; i<nlocal; i++) { > xx[i] += xx[i-1]; > }
