[petsc-users] portability question for reduce operations
Ed Bueler
elbueler at alaska.edu
Fri Apr 10 16:25:01 CDT 2015
Dear PETSc --
Now that PetscGlobalSum() and related are gone, I am exposed to
MPI_Allreduce(), which is fine.
PETSc defines some MPIU_ data types, apparently for portability. But runs
with MPIU_INT (option 1 below) break for me on one machine; this seems to
be about the petsc configuration. I have fixed this by using option 3
below.
What is the most portable of these three, or is there yet a more portable
way?:
option 1. full use of MPIU_ types and ops:
PetscReal x, xloc;
PetscInt n, nloc;
MPI_Allreduce(&xloc,&x,1,MPIU_REAL,MPIU_SUM,comm);
MPI_Allreduce(&nloc,&n,1,MPIU_INT,MPIU_SUM,comm);
option 2. use of MPIU_REAL but not MPIU_INT:
PetscReal x, xloc;
PetscInt n, nloc;
MPI_Allreduce(&xloc,&x,1,MPIU_REAL,MPIU_SUM,comm);
MPI_Allreduce(&nloc,&n,1,MPI_INT,MPI_SUM,comm);
option 3. only use MPI's primitive MPI_ types:
PetscReal x, xloc;
PetscInt n, nloc;
MPI_Allreduce(&xloc,&x,1,MPI_DOUBLE,MPI_SUM,comm);
MPI_Allreduce(&nloc,&n,1,MPI_INT,MPI_SUM,comm);
I couldn't find discussion of allreduce usage in the petsc manual.
Thanks!
Ed
PS With option 1 on one machine I get "PETSC ERROR: Can only handle
MPIU_REAL or MPIU_COMPLEX data types" in parallel but no error in serial.
On my two other machines there is no error with option 1. All three
machines work fine with option 3. I have not tested option 2.
--
Ed Bueler
Dept of Math and Stat and Geophysical Institute
University of Alaska Fairbanks
Fairbanks, AK 99775-6660
301C Chapman and 410D Elvey
907 474-7693 and 907 474-7199 (fax 907 474-5394)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150410/a85b7b7d/attachment.html>
More information about the petsc-users
mailing list