Hey guys I am trying to do a simple find min operation using cilk plus reducers. For some odd reason i am able to include the reducer_min libraries but I am not able to use the function calc_min. Does anyone know why I am getting this error?
47: error: 'class cilk::reducer_min_index' has no member named 'calc_min'
#include <cilk.h>
#include <reducer_min.h>
#include <iostream>
void findMin(int *d, int *v)
{
int nv, totalnv;
*d = largeint;
cilk::reducer_min_index<unsigned,int> min;
cilk_for (int i = 0; i < totalnv ; i++)
{
if(notdone[i] && mind[i] < min.get_value())
{
min.calc_min(i,ohd[i]);
}
}
cilk_sync;
*v = min.get_index();
*d = min.get_value();
}
Any advice would be greatly appreciated!
You might have to cast the i to unsigned, to fit with the template
cilk::reducer_min_index<unsigned,int>
.So replace
min.calc_min(i,ohd[i]);
withmin.calc_min((unsigned)i,ohd[i]);
Source: Source code