74 const dim3 nthrds(1024, 1, 1);
75 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
79 nblcks, nthrds, 0, stream,
81 (
const real *) alpha, *p_cur, *n);
87 void *alpha_d ,
real *alpha,
int *p_cur,
int * n) {
89 const dim3 nthrds(1024, 1, 1);
90 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
91 const int nb = ((*n) + 1024 - 1)/ 1024;
100 fusedcg_buf[1] = (*alpha);
103 real *alpha_d_p_cur = ((
real *) alpha_d) + ((*p_cur - 1));
104 HIP_CHECK(hipMemcpyAsync(alpha_d_p_cur, &fusedcg_buf[1],
sizeof(
real),
105 hipMemcpyHostToDevice, stream));
108 nblcks, nthrds, 0, stream,
110 *alpha, fusedcg_buf_d, * n);
114 1, 1024, 0, stream, fusedcg_buf_d, nb);
120 HIP_CHECK(hipMemcpyAsync(fusedcg_buf, fusedcg_buf_d,
sizeof(
real),
121 hipMemcpyDeviceToHost, stream));
128 HIP_CHECK(hipMemcpyAsync(fusedcg_buf, fusedcg_buf_d,
sizeof(
real),
129 hipMemcpyDeviceToHost, stream));
133 return fusedcg_buf[0];
__global__ void fusedcg_part2_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T alpha, T *buf_h, const int n)
real hip_fusedcg_part2(void *a, void *b, void *c, void *alpha_d, real *alpha, int *p_cur, int *n)