-
Hi every one, I am new member in this group. My name is Adnan. #include <cilk/cilk.h> long num_step;
} int main(int argc, char *argv[]) { |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@adnan4791 Hi Adnan! Thank you for this question. The code you posted certainly shows a correct way of implementing a recursive parallel reduction. In OpenCilk, however, reducers work fairly differently. A principal difference, in particular, is that the OpenCilk runtime internally implements various optimizations to handle reducers efficiently. Let me go over a couple of similar code snippets to show the semantics of Cilk reducers and demonstrate at least one optimization that OpenCilk does internally. You can also find these codes in this attached (and zipped) source file: reducer-implementation-illustration.zip Reducers and
|
Beta Was this translation helpful? Give feedback.
-
How do i use cilk_reducer to write data to file?? |
Beta Was this translation helpful? Give feedback.
@adnan4791 Hi Adnan!
Thank you for this question. The code you posted certainly shows a correct way of implementing a recursive parallel reduction. In OpenCilk, however, reducers work fairly differently. A principal difference, in particular, is that the OpenCilk runtime internally implements various optimizations to handle reducers efficiently.
Let me go over a couple of similar code snippets to show the semantics of Cilk reducers and demonstrate at least one optimization that OpenCilk does internally. You can also find these codes in this attached (and zipped) source file: reducer-implementation-illustration.zip
Reducers and
cilk_for
in OpenCilk 2.0Just as a starting/reference point, h…