52 void *b1,
void *b2,
void *b3,
55 const dim3 nthrds(1024, 1, 1);
56 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
60 nblcks, nthrds, 0, stream,
68 void *z1,
void *z2,
void *z3,
69 void *po1,
void *po2,
void *po3,
72 const dim3 nthrds(1024, 1, 1);
73 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
78 nblcks, nthrds, 0, stream,
88 void *p1,
void *p2,
void *p3,
89 void *alpha,
int *p_cur,
int *n) {
91 const dim3 nthrds(1024, 1, 1);
92 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
97 nblcks, nthrds, 0, stream,
99 (
const real **) p1, (
const real **) p2,
100 (
const real **) p3, (
const real *) alpha,
106 void *c1,
void *c2,
void *c3,
void *alpha_d ,
107 real *alpha,
int *p_cur,
int * n) {
109 const dim3 nthrds(1024, 1, 1);
110 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
111 const int nb = ((*n) + 1024 - 1)/ 1024;
120 fusedcg_cpld_buf[1] = (*alpha);
123 real *alpha_d_p_cur = ((
real *) alpha_d) + ((*p_cur - 1));
124 HIP_CHECK(hipMemcpyAsync(alpha_d_p_cur, &fusedcg_cpld_buf[1],
125 sizeof(
real), hipMemcpyHostToDevice,
129 nblcks, nthrds, 0, stream,
132 (
real *) c3, *alpha, fusedcg_cpld_buf_d,
137 1, 1024, 0, stream, fusedcg_cpld_buf_d, nb);
140#ifdef HAVE_DEVICE_MPI
145 HIP_CHECK(hipMemcpyAsync(fusedcg_cpld_buf, fusedcg_cpld_buf_d,
sizeof(
real),
146 hipMemcpyDeviceToHost, stream));
150 return fusedcg_cpld_buf[0];
__global__ void fusedcg_cpld_update_p_kernel(T *__restrict__ p1, T *__restrict__ p2, T *__restrict__ p3, const T *__restrict__ z1, const T *__restrict__ z2, const T *__restrict__ z3, const T *__restrict__ po1, const T *__restrict__ po2, const T *__restrict__ po3, const T beta, const int n)
__global__ void fusedcg_cpld_part2_kernel(T *__restrict__ a1, T *__restrict__ a2, T *__restrict__ a3, const T *__restrict__ b, const T *__restrict__ c1, const T *__restrict__ c2, const T *__restrict__ c3, const T alpha, T *buf_h, const int n)
__global__ void fusedcg_cpld_update_x_kernel(T *__restrict__ x1, T *__restrict__ x2, T *__restrict__ x3, const T **p1, const T **p2, const T **p3, const T *__restrict__ alpha, const int p_cur, const int n)
__global__ void fusedcg_cpld_part1_kernel(T *__restrict__ a1, T *__restrict__ a2, T *__restrict__ a3, T *__restrict__ b1, T *__restrict__ b2, T *__restrict__ b3, T *__restrict__ tmp, const int n)
__global__ void reduce_kernel(T *bufred, const int n)
void device_mpi_allreduce(void *buf_d, void *buf, int count, int nbytes, int op)
cuda_buffer_t fusedcg_cpld_redbuf
void hip_fusedcg_cpld_update_x(void *x1, void *x2, void *x3, void *p1, void *p2, void *p3, void *alpha, int *p_cur, int *n)
void hip_fusedcg_cpld_update_p(void *p1, void *p2, void *p3, void *z1, void *z2, void *z3, void *po1, void *po2, void *po3, real *beta, int *n)
real hip_fusedcg_cpld_part2(void *a1, void *a2, void *a3, void *b, void *c1, void *c2, void *c3, void *alpha_d, real *alpha, int *p_cur, int *n)
void hip_fusedcg_cpld_part1(void *a1, void *a2, void *a3, void *b1, void *b2, void *b3, void *tmp, int *n)
void hip_buffer_reserve(hip_buffer_t *buf, size_t size)
struct hip_buffer hip_buffer_t