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