Date: 2021-09-20T09:44:01+00:00

Actual source code: cycliccuda.cu
slepc-3.15.2 2021-09-20
Report Typos and Errors

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-2021, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */
     10: /*
     11:    SLEPc singular value solver: "cyclic" (CUDA implementation)
     12: */
     13: #include <slepc/private/svdimpl.h>
     14: #include "../src/svd/impls/cyclic/cyclic.h"

     16: PetscErrorCode MatMult_Cyclic_CUDA(Mat B,Vec x,Vec y)
     17: {
     19:   SVD            svd;
     20:   SVD_CYCLIC     *cyclic;
     21:   PetscScalar    *d_px,*d_py;
     22:   PetscInt       m;

     25:   MatShellGetContext(B,(void**)&svd);
     26:   cyclic = (SVD_CYCLIC*)svd->data;
     27:   MatGetLocalSize(svd->A,&m,NULL);
     28:   VecCUDAGetArrayRead(x,(const PetscScalar**)&d_px);
     29:   VecCUDAGetArray(y,&d_py);
     30:   VecCUDAPlaceArray(cyclic->x1,d_px);
     31:   VecCUDAPlaceArray(cyclic->x2,d_px+m);
     32:   VecCUDAPlaceArray(cyclic->y1,d_py);
     33:   VecCUDAPlaceArray(cyclic->y2,d_py+m);
     34:   MatMult(svd->A,cyclic->x2,cyclic->y1);
     35:   MatMult(svd->AT,cyclic->x1,cyclic->y2);
     36:   VecCUDAResetArray(cyclic->x1);
     37:   VecCUDAResetArray(cyclic->x2);
     38:   VecCUDAResetArray(cyclic->y1);
     39:   VecCUDAResetArray(cyclic->y2);
     40:   VecCUDARestoreArrayRead(x,(const PetscScalar**)&d_px);
     41:   VecCUDARestoreArray(y,&d_py);
     42:   return(0);
     43: }