-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTPZCudaCalls.h
52 lines (33 loc) · 1.92 KB
/
TPZCudaCalls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef TPZCudaCalls_H
#define TPZCudaCalls_H
#include "TPZVecGPU.h"
#include "pzreal.h"
#include <cublas_v2.h>
#include <cusparse.h>
#include <cusolverSp.h>
class TPZCudaCalls {
public:
TPZCudaCalls();
~TPZCudaCalls();
TPZCudaCalls &operator=(const TPZCudaCalls ©);
void Multiply(bool trans, int *m, int *n, int *k, REAL *A, int *strideA, REAL *B, int *strideB, REAL *C, int *strideC, REAL alpha, int nmatrices);
void GatherOperation(int n, REAL *x, REAL *y, int *id);
void ScatterOperation(int n, REAL *x, REAL *y, int *id);
void DaxpyOperation(int n, REAL alpha, REAL *x, REAL *y);
void SpMSpM(int opt, int sym, int m, int n, int k, int nnzA, REAL *csrValA, int *csrRowPtrA, int *csrColIndA, int nnzB, REAL *csrValB, int *csrRowPtrB, int *csrColIndB, int nnzC, REAL *csrValC, int *csrRowPtrC);
void SpMV(int opt, int sym, int m, int k, int nnz, REAL alpha, REAL *csrVal, int *csrRowPtr, int *csrColInd, REAL *B, REAL *C) ;
void ComputeSigma(bool update_mem, int npts, REAL *glob_delta_strain, REAL *glob_sigma, REAL lambda, REAL mu, REAL mc_phi, REAL mc_psi, REAL mc_cohesion, REAL *dPlasticStrain,
REAL *dMType, REAL *dAlpha, REAL *dSigma, REAL *dStrain, REAL *weight);
void ComputeSigmaDep(bool update_mem, int npts, REAL *glob_delta_strain, REAL *glob_sigma, REAL *glob_dep, REAL lambda, REAL mu, REAL mc_phi, REAL mc_psi, REAL mc_cohesion, REAL *dPlasticStrain,
REAL *dMType, REAL *dAlpha, REAL *dSigma, REAL *dStrain, REAL *weight);
void MatrixAssemble(REAL *Kc, REAL *dep, int nel, int *el_color_index,
REAL *storage, int *rowsizes, int *colsizes, int *rowfirstindex, int *colfirstindex, int *matrixposition, int *matrixstride);
void SolveCG(int n, int nnzA, REAL *csrValA, int *csrRowPtrA, int *csrColIndA, REAL *b, REAL *x);
void DeToDevice(REAL lambda, REAL mu);
private:
cusparseHandle_t handle_cusparse;
bool cusparse_h;
cublasHandle_t handle_cublas;
bool cublas_h;
};
#endif