Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: fix undefined behavior in cusolver #5251

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions source/module_hsolver/kernels/cuda/diag_cusolver.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ class Diag_Cusolver_gvd{
// private variables
//-------------------

cusolverDnHandle_t cusolverH;
cusolverDnHandle_t cusolverH = nullptr;

cusolverEigType_t itype; //problem type: A*x = (lambda)*B*x
cusolverEigMode_t jobz; // compute eigenvalues and eigenvectors.
cublasFillMode_t uplo;
cusolverEigType_t itype = CUSOLVER_EIG_TYPE_1; //problem type: A*x = (lambda)*B*x
cusolverEigMode_t jobz = CUSOLVER_EIG_MODE_NOVECTOR; // compute eigenvalues and eigenvectors.
cublasFillMode_t uplo = CUBLAS_FILL_MODE_LOWER;

int m;
int lda;
int m = 0;
int lda = 0;

double *d_A;
double *d_B;
double *d_work;
double *d_A = nullptr;
double *d_B = nullptr;
double *d_work = nullptr;

cuDoubleComplex *d_A2;
cuDoubleComplex *d_B2;
cuDoubleComplex *d_work2;
cuDoubleComplex *d_A2 = nullptr;
cuDoubleComplex *d_B2 = nullptr;
cuDoubleComplex *d_work2 = nullptr;

double *d_W ;
int *devInfo;
double *d_W = nullptr;
int *devInfo = nullptr;

int lwork;
int info_gpu;
int lwork = 0;
int info_gpu = 0;

// subroutines that are related to initializing the class:
// - init_double : initializing relevant double type data structures and gpu apis' handle and memory
Expand All @@ -55,7 +55,7 @@ class Diag_Cusolver_gvd{
void finalize(); // for recycling the usage of the static class Diag_Cusolver_gvd
public:

int is_init; // For expensive gpu initialization only once when using cusolver for lcao
int is_init = 0; // For expensive gpu initialization only once when using cusolver for lcao

Diag_Cusolver_gvd();
~Diag_Cusolver_gvd();
Expand Down