67 cudaStream_t stream) {
72 cudaMemcpyDeviceToHost, stream));
73 cudaStreamSynchronize(stream);
75 if (
sizeof(
real_xp) ==
sizeof(
float)) {
76 nvshmemx_float_sum_reduce_on_stream(NVSHMEM_TEAM_WORLD, (
float *) dev,
77 (
float *) dev, count, stream);
79 else if (
sizeof(
real_xp) ==
sizeof(
double)) {
80 nvshmemx_double_sum_reduce_on_stream(NVSHMEM_TEAM_WORLD, (
double *) dev,
81 (
double *) dev, count, stream);
84 cudaMemcpyDeviceToHost, stream));
85 cudaStreamSynchronize(stream);
87 cudaStreamSynchronize(stream);
91 cudaMemcpyDeviceToHost, stream));
92 cudaStreamSynchronize(stream);
101 real *omega,
int *n) {
106 const dim3 nthrds(1024, 1, 1);
107 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
111 <<<nblcks, nthrds, 0, stream>>>((
real *) p, (
real *) r, (
real *)
v,
123 const dim3 nthrds(1024, 1, 1);
124 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
125 const int nb = ((*n) + 1024 - 1) / 1024;
129 2 * (nb > 1 ? nb : 1) *
sizeof(
real_xp));
135 <<<nblcks, nthrds, 0, stream>>>((
real *) a, (
real *) b, (
real *) mult,
155 real *alpha,
int *n) {
157 const dim3 nthrds(1024, 1, 1);
158 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
159 const int nb = ((*n) + 1024 - 1) / 1024;
163 2 * (nb > 1 ? nb : 1) *
sizeof(
real_xp));
169 <<<nblcks, nthrds, 0, stream>>>((
real *) s, (
real *) r, (
real *)
v,
170 (
real *) mult, dev, *alpha, *n);
190 void *s,
void *t,
void *f,
void *mult,
193 const dim3 nthrds(1024, 1, 1);
194 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
195 const int nb = ((*n) + 1024 - 1) / 1024;
199 2 * (nb > 1 ? nb : 1) *
sizeof(
real_xp));
205 <<<nblcks, nthrds, 0, stream>>>((
real *)
x, (
real *) r,
cuda_buffer_t bicgstab_redbuf
void cuda_bicgstab_product_and_norm(void *a, void *b, void *mult, real_xp *res, int *n)
static void bicgstab_reduce(real_xp *host, real_xp *dev, const int count, cudaStream_t stream)
void cuda_bicgstab_update_p(void *p, void *r, void *v, real *beta, real *omega, int *n)
void cuda_bicgstab_part2(void *x, void *r, void *p_hat, void *s_hat, void *s, void *t, void *f, void *mult, real *alpha, real *omega, real_xp *res, int *n)
real_xp cuda_bicgstab_part1(void *s, void *r, void *v, void *mult, real *alpha, int *n)
void cuda_buffer_reserve(cuda_buffer_t *buf, size_t size)
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void bicgstab_update_p_kernel(T *__restrict__ p, const T *__restrict__ r, const T *__restrict__ v, const T beta, const T omega, const int n)
__global__ void bicgstab_product_and_norm_kernel(const T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ mult, T_acc *__restrict__ buf_h, const int n)
__global__ void bicgstab_part1_kernel(T *__restrict__ s, const T *__restrict__ r, const T *__restrict__ v, const T *__restrict__ mult, T_acc *__restrict__ buf_h, const T alpha, const int n)
__global__ void bicgstab_part2_kernel(T *__restrict__ x, T *__restrict__ r, const T *__restrict__ p_hat, const T *__restrict__ s_hat, const T *__restrict__ s, const T *__restrict__ t, const T *__restrict__ f, const T *__restrict__ mult, T_acc *__restrict__ buf_h, const T alpha, const T omega, const int n)
struct cuda_buffer cuda_buffer_t
#define CUDA_BUFFER_INIT_SYMM
__global__ void const T *__restrict__ x
__global__ void reduce_kernel(T *bufred, const int n)
__global__ void glsc3_reduce_kernel(T_acc *bufred, const int n, const int j)
void device_mpi_allreduce(void *buf_d, void *buf, int count, int nbytes, int op)
void device_nccl_allreduce(void *sbuf_d, void *rbuf_d, int count, int nbytes, int op, void *stream)