Actual source code: petscglobal.c
petsc-3.3-p7 2013-05-11
2: #include <petscsys.h>
6: /*@C
7: PetscGlobalMax - Computes the maximum value over several processors. Only for use with ADIC!
9: Collective on MPI_Comm
11: Input Parameters:
12: + local - the local value
13: - comm - the processors that find the maximum
15: Output Parameter:
16: . result - the maximum value
17:
18: Level: intermediate
20: Notes:
21: These functions are to be used ONLY inside user functions that are to be processed with
22: ADIC. PETSc will automatically provide differentiated versions of these functions
24: .seealso: PetscGlobalMin(), PetscGlobalSum()
25: @*/
26: PetscErrorCode PetscGlobalMax(MPI_Comm comm,const PetscReal* local,PetscReal* result)
27: {
28: return MPI_Allreduce((void*)local,result,1,MPIU_REAL,MPIU_MAX,comm);
29: }
33: /*@C
34: PetscGlobalMin - Computes the minimum value over several processors. Only for use with ADIC!
36: Collective on MPI_Comm
38: Input Parameters:
39: + local - the local value
40: - comm - the processors that find the minimum
42: Output Parameter:
43: . result - the minimum value
44:
45: Level: intermediate
47: Notes:
48: These functions are to be used ONLY inside user functions that are to be processed with
49: ADIC. PETSc will automatically provide differentiated versions of these functions
51: .seealso: PetscGlobalMax(), PetscGlobalSum()
52: @*/
53: PetscErrorCode PetscGlobalMin(MPI_Comm comm,const PetscReal* local,PetscReal* result)
54: {
55: return MPI_Allreduce((void*)local,result,1,MPIU_REAL,MPIU_MIN,comm);
56: }
60: /*@C
61: PetscGlobalSum - Computes the sum over several processors. Only for use with ADIC!
63: Collective on MPI_Comm
65: Input Parameters:
66: + local - the local value
67: - comm - the processors that find the sum
69: Output Parameter:
70: . result - the sum
71:
72: Level: intermediate
74: Notes:
75: These functions are to be used ONLY inside user functions that are to be processed with
76: ADIC. PETSc will automatically provide differentiated versions of these functions
78: .seealso: PetscGlobalMin(), PetscGlobalMax()
79: @*/
80: PetscErrorCode PetscGlobalSum(MPI_Comm comm, const PetscScalar* local,PetscScalar* result)
81: {
82: return MPI_Allreduce((void*)local,result,1,MPIU_SCALAR,MPIU_SUM,comm);
83: }