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];
}
signature.asc
Description: PGP signature
