calc_min function of reducer_min_index isn't found

139 views Asked by At

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!

2

There are 2 answers

1
SilverCorvus On

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]); with min.calc_min((unsigned)i,ohd[i]);

Source: Source code

0
Neil Faiman On

All that I can say for sure is that it works for me.

It would help to know what platform you are on and what version of the Cilk libraries you are using. (If you are using the Intel compiler, that is the same as your compiler version. If you are using the Cilk open-source kit, then you can define the environment variable CILK_VERSION and run any Cilk program to print the Cilk version information.)

By the way, note that the Cilk library headers would be in the cilk subdirectory of a directory in the default compiler include path, so the normal way to include them is with

#include <cilk/cilk.h>
#include <cilk/reducer_min.h>

If you use that form, you will get the headers from the standard location without needing to add the Cilk library to your include path.


Neil Faiman
Intel Cilk Plus Runtime Development