1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-07-25 20:27:35 +02:00
This commit is contained in:
Anthony Scemama 2023-07-16 13:16:11 +02:00
parent 358002d70f
commit 8abf589c90

View File

@ -94,7 +94,6 @@ void compute_r2_space_chol_gpu(const int nO, const int nV, const int cholesky_mo
{
double* d_tmp_cc_ = &(d_tmp_cc[gam*nV*cholesky_mo_num]);
double* d_cc_space_v_vv_chol_ = &(d_cc_space_v_vv_chol[gam*nV*cholesky_mo_num]);
// double* cc_space_v_vv_chol_ = &(cc_space_v_vv_chol[gam*nV*cholesky_mo_num]);
alpha = 1.0;
beta = -1.0;
@ -103,13 +102,6 @@ void compute_r2_space_chol_gpu(const int nO, const int nV, const int cholesky_mo
C = d_tmp_cc2 ; ldc = cholesky_mo_num;
cublasDgeam(handle, CUBLAS_OP_N, CUBLAS_OP_N, cholesky_mo_num, nV, &alpha, A, lda, &beta, B, ldb, C, ldc);
/*
for (size_t l=0 ; l<nV*cholesky_mo_num ; ++l) {
tmp_cc2[l] = cc_space_v_vv_chol_[l] - tmp_cc_[l];
}
cublasSetMatrix(cholesky_mo_num, nV, sizeof(double), tmp_cc2, cholesky_mo_num, d_tmp_cc2, cholesky_mo_num);
*/
for (size_t iblock=0 ; iblock<nV ; iblock += BLOCK_SIZE)
{
const size_t mbs = BLOCK_SIZE < nV-iblock ? BLOCK_SIZE : nV-iblock;
@ -122,16 +114,6 @@ void compute_r2_space_chol_gpu(const int nO, const int nV, const int cholesky_mo
C=d_tmpB1 ; ldc=nV*BLOCK_SIZE;
cublasDgemm(handle, CUBLAS_OP_T, CUBLAS_OP_N, m, n, k, &alpha, A, lda, B, lda, &beta, C, ldc);
/*
A=&(tmp_cc[iblock*cholesky_mo_num*nV]); lda=cholesky_mo_num;
B=cc_space_v_vv_chol_; ldb=cholesky_mo_num;
C=tmpB1 ; ldc=nV*BLOCK_SIZE;
dgemm_("T","N", &m, &n, &k, &alpha, A, &lda, B, &lda, &beta, C, &ldc);
*/
alpha=1.0; beta=1.0;
m=nV*mbs; n=nV; k=cholesky_mo_num;
@ -139,25 +121,22 @@ void compute_r2_space_chol_gpu(const int nO, const int nV, const int cholesky_mo
B=d_tmp_cc2; ldb=cholesky_mo_num;
C=d_tmpB1 ; ldc=nV*BLOCK_SIZE;
cublasDgemm(handle, CUBLAS_OP_T, CUBLAS_OP_N, m, n, k, &alpha, A, lda, B, lda, &beta, C, ldc);
cublasGetMatrix(m, n, sizeof(double), d_tmpB1, ldc, tmpB1, ldc);
/*
A=&(cc_space_v_vv_chol[iblock*cholesky_mo_num*nV]); lda=cholesky_mo_num;
B=tmp_cc2; ldb=cholesky_mo_num;
C=tmpB1 ; ldc=nV*BLOCK_SIZE;
dgemm_("T","N", &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc);
*/
// cublasGetMatrix(m, n, sizeof(double), d_tmpB1, ldc, tmpB1, ldc);
for (size_t beta=iblock ; beta<(nV < iblock+BLOCK_SIZE ? nV : iblock+BLOCK_SIZE) ; ++beta) {
for (size_t b=0 ; b<nV ; ++b) {
cublasDcopy(handle, nV, &(d_tmpB1[nV*(beta-iblock + BLOCK_SIZE*b)]), 1,
&(d_B1[nV*(b + nV*(beta-iblock))]),1);
/*
for (size_t a=0 ; a<nV ; ++a) {
B1[a + nV*(b + nV*(beta-iblock))] =
tmpB1[a + nV*(beta-iblock + BLOCK_SIZE*b)];
}
*/
}
}
cublasSetMatrix(nV*nV, mbs, sizeof(double), B1, nV*nV, d_B1, nV*nV);
// cublasSetMatrix(nV*nV, mbs, sizeof(double), B1, nV*nV, d_B1, nV*nV);
alpha=1.0; beta=1.0;
m=nO*nO; n=mbs; k=nV*nV;
@ -166,12 +145,6 @@ void compute_r2_space_chol_gpu(const int nO, const int nV, const int cholesky_mo
B=d_B1 ; ldb=nV*nV;
C=&(d_r2[nO*nO*(iblock + nV*gam)]); ldc=nO*nO;
cublasDgemm(handle, CUBLAS_OP_N, CUBLAS_OP_N, m, n, k, &alpha, A, lda, B, ldb, &beta, C, ldc);
/*
A=tau; lda=nO*nO;
B=B1 ; ldb=nV*nV;
C=&(r2[nO*nO*(iblock + nV*gam)]); ldc=nO*nO;
dgemm_("N","N", &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc);
*/
}
}