- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm attaching the example of writing the reducer for linked list. The problem is that i get an error at compile time as follows:
test1.cpp(81): error: class "cilk::reducer<IntListMonoid>" has no member "add_value"
list->add_value(i); // "list->" accesses the view
^
test1.cpp(84): error: class "cilk::reducer<IntListMonoid>" has no member "get_value"
return list->get_value(); // "list->" accesses the view
^
It does not allow me to access the view class members even though i have made "IntListMonoid" a friend class in "IntListView" class. So please anybody can help me out of this?
--Abdul Jabbar--
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I see an attachment which is the guide to writing reducers, but not test1.cpp?
I was able to copy the entire last example and compile without any errors. Which compiler are you using, and what flags did you pass in to compile the program?
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the attached test program, "list" is declared as a pointer to a reducer.
cilk::reducer<IntListMonoid> *list;
In the example in the documentation, the reducer is declared as:
cilk::reducer<IntListMonoid> list;
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it is still not working . Now it is giving me error that expression (list->addvalue(i)) must have pointer type. And when I use dot instead of arrow in the expression then it gives me previous error. I still don't know what I'm missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm... that is odd... What does "icpc -V" return, i.e., which version string does it return?
If you use "icc -H", does it bring in the reducer.h file that you think it should be including? What does your copy of "reducer_list.h" look like?
This question is likely unrelated, but why do you have the preprocessor flags of "-DTIMES_TO_RUN=1 -DCILKM_RTS=1" specified?
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icpc version is 12.1.3 (gcc version 4.1.2). Is this problem could be because of older version of gcc?
And yes, icc -H or icpc -H do bring the reducer.h file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah. You have an older version of the compiler, which has an older version of the header files for reducers.
In the old syntax for reducers, the way to access the reducer view used to be to use "operator ()", i.e., to write:
list().add_value(i);
In the newer syntax, you use the dereference operator:
list->add_value(i).
The newer header files are backwards compatible --- they will still take the old syntax, although we consider that syntax to be deprecated.
But the reducer guide was written recently, and uses the newer syntax.
There are probably several ways to fix your problem. You could (1) update your compiler to the latest 12.1 version, which comes with updated header files, (2) use the old deprecated syntax, or (3) try to patch the reducer.h file to the new syntax.
Is there any difficulty with updating your compiler for your project? The first option would be the one I would recommend, as the other two are asking for trouble down the line...
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim. The older version syntax worked.
Regards,
Abdul Jabbar

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page