chundoong-lab-ta/APWS23/sum-reduction/reduction_cpu.cpp

7 lines
175 B
C++

#include "reduction.h"
double reduction_cpu(double *A, size_t num_elements) {
double sum = 0.0;
for (size_t i = 0; i < num_elements; i++) { sum += A[i]; }
return sum;
}