Software Archive
Read-only legacy content
17061 Discussions

Vector of reducers that are not cache aligned

John_E_5
Beginner
343 Views

I am using Cilk and a custom reducer as described here: https://software.intel.com/en-us/node/522608. In the example, they use the reducer for append operation in a linked list.

Now, I want to create a vector of reducers (using std::vector); however, I get the following runtime error: 

Reducer should be cache aligned. Please see comments following this assertion for explanation and fixes.

After looking at the comments (line 948 here: https://github.com/Nyks45/Toolchain/blob/master/lib/gcc/x86_64-unknown-linux-gnu/5.3.1/include/cilk/reducer.h) I realized that I need to use "new-style" reducers to work around this so that they are not necessarily cache-aligned. However, I cannot find any documentation/example of how I can create a custom "new-style" reducer.

How do I create a custom "new-style" reducer for the above linked-list example?

0 Kudos
2 Replies
Hansang_B_Intel
Employee
343 Views

Have you tried the second method described in https://software.intel.com/en-us/node/522608, which uses the monoid_with_view class ?

This class does not have the alignment requirement, and the new-style reducers are all based on the monoid_with_view class.

0 Kudos
Pablo_H_Intel
Employee
343 Views

By default, reducers are unaligned. For your reducer to be aligned, the align_reducer member of your monoid class would need to be true (it is false by default).  How are you defining your monoid?  If you are using monoid_with_view<ViewType,Align>, the alignment is false by default, but if you specify a true as the second parameter, it will get turned on.

0 Kudos
Reply