Skip to content

Commit 7ba1a3b

Browse files
author
cs293-ahilkhancse
committed
resolved redefinition error in prod.cpp
1 parent 16907a8 commit 7ba1a3b

File tree

5 files changed

+4
-2
lines changed

5 files changed

+4
-2
lines changed
File renamed without changes.

prod

0 Bytes
Binary file not shown.

src/prod.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ double compute_log_sum(int* a, int size, int num_threads) {
2525
// Function to find number of negative numbers in parallel
2626
pair<int, int> count_negative_and_zero(int* a, int size, int num_threads) {
2727
int negative_count = 0, zero_count = 0;
28+
int i;
2829

29-
#pragma omp parallel for private(negative_count, zero_count) reduction(+:negative_count, zero_count) num_threads(num_threads)
30-
for (int i = 0; i < size; i++) {
30+
#pragma omp parallel for private(i) reduction(+:negative_count, zero_count) num_threads(num_threads)
31+
for (i = 0; i < size; i++) {
3132
if(a[i] < 0 )negative_count++;
3233
else if(a[i] == 0)zero_count++;
3334
}

src/wrong_sum.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ int parallel_sum(const int arr[], int size, int step_size) {
2020
#pragma omp task
2121
{
2222
int psum = 0;
23+
// int psum = arr[i];
2324
std::cout << "Task computing Sum(" << start << "," << end << ") from "
2425
<< omp_get_thread_num() << " of " << omp_get_num_threads() << std::endl;
2526

wrong_sum

17.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)