xref: /petsc/src/vec/vec/impls/mpi/pvec2.c (revision aaa8cc7d2a5c3913edcbb923e20f154fe9c4aa65)
1 
2 /*
3      Code for some of the parallel vector primitives.
4 */
5 #include <../src/vec/vec/impls/mpi/pvecimpl.h>
6 #include <petscblaslapack.h>
7 
8 PetscErrorCode VecDot_MPI(Vec xin, Vec yin, PetscScalar *z)
9 {
10   PetscFunctionBegin;
11   PetscCall(VecXDot_MPI_Default(xin, yin, z, VecDot_Seq));
12   PetscFunctionReturn(PETSC_SUCCESS);
13 }
14 
15 PetscErrorCode VecTDot_MPI(Vec xin, Vec yin, PetscScalar *z)
16 {
17   PetscFunctionBegin;
18   PetscCall(VecXDot_MPI_Default(xin, yin, z, VecTDot_Seq));
19   PetscFunctionReturn(PETSC_SUCCESS);
20 }
21 
22 PetscErrorCode VecMDot_MPI(Vec xin, PetscInt nv, const Vec y[], PetscScalar *z)
23 {
24   PetscFunctionBegin;
25   PetscCall(VecMXDot_MPI_Default(xin, nv, y, z, VecMDot_Seq));
26   PetscFunctionReturn(PETSC_SUCCESS);
27 }
28 
29 PetscErrorCode VecMTDot_MPI(Vec xin, PetscInt nv, const Vec y[], PetscScalar *z)
30 {
31   PetscFunctionBegin;
32   PetscCall(VecMXDot_MPI_Default(xin, nv, y, z, VecMTDot_Seq));
33   PetscFunctionReturn(PETSC_SUCCESS);
34 }
35 
36 PetscErrorCode VecNorm_MPI(Vec xin, NormType type, PetscReal *z)
37 {
38   PetscFunctionBegin;
39   PetscCall(VecNorm_MPI_Default(xin, type, z, VecNorm_Seq));
40   PetscFunctionReturn(PETSC_SUCCESS);
41 }
42 
43 PetscErrorCode VecMax_MPI(Vec xin, PetscInt *idx, PetscReal *z)
44 {
45   const MPI_Op ops[] = {MPIU_MAXLOC, MPIU_MAX};
46 
47   PetscFunctionBegin;
48   PetscCall(VecMinMax_MPI_Default(xin, idx, z, VecMax_Seq, ops));
49   PetscFunctionReturn(PETSC_SUCCESS);
50 }
51 
52 PetscErrorCode VecMin_MPI(Vec xin, PetscInt *idx, PetscReal *z)
53 {
54   const MPI_Op ops[] = {MPIU_MINLOC, MPIU_MIN};
55 
56   PetscFunctionBegin;
57   PetscCall(VecMinMax_MPI_Default(xin, idx, z, VecMin_Seq, ops));
58   PetscFunctionReturn(PETSC_SUCCESS);
59 }
60