3 #include <hip/hip_runtime.h> 16 hipCheck(hipMalloc(&in1_d, size *
sizeof(
float)));
17 hipCheck(hipMalloc(&in2_d, size *
sizeof(
float)));
18 hipCheck(hipMalloc(&out_d, size *
sizeof(
float)));
21 hipCheck(hipMemcpy(in1_d, in1_h, size *
sizeof(
float), hipMemcpyHostToDevice));
22 hipCheck(hipMemcpy(in2_d, in2_h, size *
sizeof(
float), hipMemcpyHostToDevice));
25 hipCheck(hipMemset(out_d, 0, size *
sizeof(
float)));
31 hipCheck(hipMemcpy(out_h, out_d, size *
sizeof(
float), hipMemcpyDeviceToHost));
47 hipCheck(hipMalloc(&in1_d, size *
sizeof(
double)));
48 hipCheck(hipMalloc(&in2_d, size *
sizeof(
double)));
49 hipCheck(hipMalloc(&out_d, size *
sizeof(
double)));
52 hipCheck(hipMemcpy(in1_d, in1_h, size *
sizeof(
double), hipMemcpyHostToDevice));
53 hipCheck(hipMemcpy(in2_d, in2_h, size *
sizeof(
double), hipMemcpyHostToDevice));
56 hipCheck(hipMemset(out_d, 0, size *
sizeof(
double)));
62 hipCheck(hipMemcpy(out_h, out_d, size *
sizeof(
double), hipMemcpyDeviceToHost));
void opaque_add_vectors_d(const double *in1, const double *in2, double *out, size_t size)
void wrapper_add_vectors_f(const float *__restrict__ in1, const float *__restrict__ in2, float *__restrict__ out, size_t size)
void opaque_add_vectors_f(const float *in1, const float *in2, float *out, size_t size)
#define hipCheck(ARG,...)
void wrapper_add_vectors_d(const double *__restrict__ in1, const double *__restrict__ in2, double *__restrict__ out, size_t size)