Very new to cilk

Very new to cilk

I am trying to compile my very first Cilk program and I get this message.

error: Calling Cilk function 'void cilk report' from non-Cilk context int Main()'

I have got several of them, in fact in this compilation it is the only error thatI got.

What does this error mean and how do I correct it?

Newport_j

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi Newport_j,

The quick fix is to rename main() to cilk_main().

The reason for this requirement is that main() is a C++ function (C, actually), and you cannot call Cilk++ functions from C++. You can call C++ functions from Cilk++, but then you cannot call back into Cilk++, again.

Generally, when you're writing a new program this is not a problem because you can simply make _all_ functions Cilk++ (the compiler will do this for you by default). The exception is main(), whichis a reserved name and cannot be a Cilk++ function. So Cilk++ allows for the optional replacement entrypoint: cilk_main(). Alternatively, whenever you call into Cilk++, you can use the cilk::run() functionality (bottom of page 76 in the SDK manual).

As a slight digression, this was one of the biggest limitations that customers identifiedin Cilk++. Frequently, they were working with a lot of code -- most of which they wanted to leave as C++. The new Intel product, Cilk Plus, has much better (more seamless) language integration with C++ such that users can call back and forth between Cilk and C/C++ freely, without thinking about it.

Let me know if there are any more errors.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya