I am running into trouble while trying to complie my Cilk Plus program. Basically when I run: g++ -o reducer reducer.cpp
, I get the following error:
-fcilkplus must be enabled to use '_Cilk_for'
I've included cilk/cilk.h
& cilk/reducer.h
, but I am not sure what exactly is causing this problem. The code represents a simple custom reducer, nothing special. Here is how the loop looks where error occurs:
cilk_for(unsigned int i = 0; i<5 ; i++){
//code
}
Note: I even tried using _Cilk_for
, still getting the same error.
You need to add enabling the cilk plus , and linking to the library, to your build.
Your build should be:
g++ -fcilkplus -lcilkrts -o reducer reducer.cpp
For further reference see Intel documentation