Question: Reduce.cpp #include #include #include #include #include #include #include #ifdef __cplusplus extern C { #endif void generateReduceData (int* arr, size_t n); #ifdef __cplusplus } #endif int

Reduce.cpp
#include
#ifdef __cplusplus extern "C" { #endif void generateReduceData (int* arr, size_t n); #ifdef __cplusplus } #endif
int main (int argc, char* argv[]) { //forces openmp to create the threads beforehand #pragma omp parallel { int fd = open (argv[0], O_RDONLY); if (fd != -1) { close (fd); } else { std::cerr int n = atoi(argv[1]); int * arr = new int [n]; generateReduceData (arr, atoi(argv[1])); //insert reduction code here delete[] arr; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
