On Fri, 30 May 2014, Matthew Knepley wrote:
I think its better to use the non-collective version:VecGetOwnershipRange(xr, &low, &high); if ((myindex >= low) && (myindex < high)) { VecGetArrayRead(xr,&a); val = a[myindex-low]; VecRestoreArrayRead(xr, &a); } MPI_Allreduce(&val, &gval, 1, MPIU_SCALAR, MPI_SUM, PETSC_COMM_WORLD);
I agree, and I used the above now. In any case, as it came out of this discussion, may I suggest that the man page of EPSSetArbitrarySelection() should document that the arbitrary selection user-defined function is collective, i.e. it is called on all nodes in PETSC_COMM_WORLD (and is thus an implicit MPI syncronisation point)? As it is now, if one just looks at the docs this is unclear, and it is consequently unclear also if one may use collective calls inside that user-defined function (the answer is yes, from this discussion). One may argue that it must be so, since the user-defined function can use the eigenvectors which by definition may be nonlocal, but making this explicit would not hurt. Giacomo -- _________________________________________________________________ Giacomo Mulas <[email protected]> _________________________________________________________________ INAF - Osservatorio Astronomico di Cagliari via della scienza 5 - 09047 Selargius (CA) tel. +39 070 71180244 mob. : +39 329 6603810 _________________________________________________________________ "When the storms are raging around you, stay right where you are" (Freddy Mercury) _________________________________________________________________
