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

7 lines
175 B
C++
Raw Normal View History

2023-02-09 01:28:51 +09:00
#include "reduction.h"
2023-02-14 01:23:28 +09:00
double reduction_cpu(double *A, size_t num_elements) {
2023-02-09 01:28:51 +09:00
double sum = 0.0;
2023-02-14 01:23:28 +09:00
for (size_t i = 0; i < num_elements; i++) { sum += A[i]; }
2023-02-09 01:28:51 +09:00
return sum;
}