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 VecMDot_MPI_GEMV(Vec xin, PetscInt nv, const Vec y[], PetscScalar *z) 29 { 30 PetscFunctionBegin; 31 PetscCall(VecMXDot_MPI_Default(xin, nv, y, z, VecMDot_Seq_GEMV)); 32 PetscFunctionReturn(PETSC_SUCCESS); 33 } 34 35 PetscErrorCode VecMTDot_MPI(Vec xin, PetscInt nv, const Vec y[], PetscScalar *z) 36 { 37 PetscFunctionBegin; 38 PetscCall(VecMXDot_MPI_Default(xin, nv, y, z, VecMTDot_Seq)); 39 PetscFunctionReturn(PETSC_SUCCESS); 40 } 41 42 PetscErrorCode VecMTDot_MPI_GEMV(Vec xin, PetscInt nv, const Vec y[], PetscScalar *z) 43 { 44 PetscFunctionBegin; 45 PetscCall(VecMXDot_MPI_Default(xin, nv, y, z, VecMTDot_Seq_GEMV)); 46 PetscFunctionReturn(PETSC_SUCCESS); 47 } 48 49 PetscErrorCode VecNorm_MPI(Vec xin, NormType type, PetscReal *z) 50 { 51 PetscFunctionBegin; 52 PetscCall(VecNorm_MPI_Default(xin, type, z, VecNorm_Seq)); 53 PetscFunctionReturn(PETSC_SUCCESS); 54 } 55 56 PetscErrorCode VecMax_MPI(Vec xin, PetscInt *idx, PetscReal *z) 57 { 58 const MPI_Op ops[] = {MPIU_MAXLOC, MPIU_MAX}; 59 60 PetscFunctionBegin; 61 PetscCall(VecMinMax_MPI_Default(xin, idx, z, VecMax_Seq, ops)); 62 PetscFunctionReturn(PETSC_SUCCESS); 63 } 64 65 PetscErrorCode VecMin_MPI(Vec xin, PetscInt *idx, PetscReal *z) 66 { 67 const MPI_Op ops[] = {MPIU_MINLOC, MPIU_MIN}; 68 69 PetscFunctionBegin; 70 PetscCall(VecMinMax_MPI_Default(xin, idx, z, VecMin_Seq, ops)); 71 PetscFunctionReturn(PETSC_SUCCESS); 72 } 73