QMCPACK
delayed_update_helper.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2019 QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef CUDA_DELAYED_UPDATE_HELPER_H
14 #define CUDA_DELAYED_UPDATE_HELPER_H
15 
16 #include <complex>
17 #include "config.h"
18 #ifndef QMC_CUDA2HIP
19 #include <cuda_runtime_api.h>
20 #else
21 #include <hip/hip_runtime.h>
22 #include "ROCm/cuda2hip.h"
23 #endif
24 
25 /** helper function for delayed update algorithm
26  * W matrix is applied and copy selected rows of Ainv into V
27  */
28 
29 void applyW_stageV_cuda(const int* delay_list_gpu,
30  const int delay_count,
31  float* temp_gpu,
32  const int numorbs,
33  const int ndelay,
34  float* V_gpu,
35  const float* Ainv,
37 
38 void applyW_stageV_cuda(const int* delay_list_gpu,
39  const int delay_count,
40  std::complex<float>* temp_gpu,
41  const int numorbs,
42  const int ndelay,
43  std::complex<float>* V_gpu,
44  const std::complex<float>* Ainv,
46 
47 void applyW_stageV_cuda(const int* delay_list_gpu,
48  const int delay_count,
49  double* temp_gpu,
50  const int numorbs,
51  const int ndelay,
52  double* V_gpu,
53  const double* Ainv,
55 
56 void applyW_stageV_cuda(const int* delay_list_gpu,
57  const int delay_count,
58  std::complex<double>* temp_gpu,
59  const int numorbs,
60  const int ndelay,
61  std::complex<double>* V_gpu,
62  const std::complex<double>* Ainv,
64 
65 /** create identity matrix on the device
66  */
67 void make_identity_matrix_cuda(const int nrows, double* mat, const int lda, cudaStream_t hstream);
68 
69 void make_identity_matrix_cuda(const int nrows, std::complex<double>* mat, const int lda, cudaStream_t hstream);
70 
71 /** extract matrix diagonal
72  */
73 void extract_matrix_diagonal_cuda(const int nrows,
74  const double* mat,
75  const int lda,
76  double* diag,
78 
79 void extract_matrix_diagonal_cuda(const int nrows,
80  const std::complex<double>* mat,
81  const int lda,
82  std::complex<double>* diag,
84 
85 /** copy matrix with precision difference
86  */
87 void copy_matrix_cuda(const int nrows,
88  const int ncols,
89  const double* mat_in,
90  const int lda,
91  float* mat_out,
92  const int ldb,
94 
95 void copy_matrix_cuda(const int nrows,
96  const int ncols,
97  const float* mat_in,
98  const int lda,
99  double* mat_out,
100  const int ldb,
102 
103 void copy_matrix_cuda(const int nrows,
104  const int ncols,
105  const std::complex<double>* mat_in,
106  const int lda,
107  std::complex<float>* mat_out,
108  const int ldb,
110 
111 void copy_matrix_cuda(const int nrows,
112  const int ncols,
113  const std::complex<float>* mat_in,
114  const int lda,
115  std::complex<double>* mat_out,
116  const int ldb,
118 
119 #endif
void make_identity_matrix_cuda(const int nrows, double *mat, const int lda, cudaStream_t hstream)
create identity matrix on the device
void extract_matrix_diagonal_cuda(const int nrows, const double *mat, const int lda, double *diag, cudaStream_t hstream)
extract matrix diagonal
void copy_matrix_cuda(const int nrows, const int ncols, const double *mat_in, const int lda, float *mat_out, const int ldb, cudaStream_t hstream)
copy matrix with precision difference
#define cudaStream_t
Definition: cuda2hip.h:149
void applyW_stageV_cuda(const int *delay_list_gpu, const int delay_count, float *temp_gpu, const int numorbs, const int ndelay, float *V_gpu, const float *Ainv, cudaStream_t hstream)
helper function for delayed update algorithm W matrix is applied and copy selected rows of Ainv into ...