Software Archive
Read-only legacy content
17061 Discussions

Calling a cilk fucntion by a c function

newport_j
Beginner
575 Views

I am confused about stub functions for calling a cilk function by a regular c function. It seems there is an inconsistency on page 13 of the Cilk-5.4.6 manual. That and the previous page discuss this issue. I made up a fibonaccii program that I am trying to get to compile, but it does not.

I have attached the screenshot of the output and a copy of my source file. Please tell me what I am doing wrong.

If there are any other errors please point them out.I thought that this code was correct The example in the cilk-5.4.6 manual on page 13 is not clear. y = EXPORT(g) (context, 3.14); and y = EXPORT(g) (&x); have different number of args.

In miine it says

argument mismatch: 1 args passed, 2 expected

I am not seeing it.


Any help appreciated. Thanks in advance.


Newport_j
0 Kudos
4 Replies
Jim_S_Intel
Employee
575 Views
I'm not sure if this is your problem, but you have declared EXPORT(fib) as returning a float in one place, but as an int in the other?
0 Kudos
newport_j
Beginner
575 Views


You are right, I caught that. In fact Ihave got my example program which I attached to previous post to compile and give me the correct answer. However, look on page 13, of the Cilk 5.4.6 manual and look at Fig. 2.4 (a) and (b). The (b) figure simply makes little sense. to me. The call line is

y = EXPORT(g) (&x). What?

I understand the first part where the Fig. 2.4 (a) and Fig. (b) hav many similarities, but the second part (context, 3.14) vs. (&x) isnot clear.Please explain the differences between, Fig. 2.4 (a) and Fig. 2.4 (b). The call lines do not seem to correlate.

Thanks in advance.


Newport_j
0 Kudos
Jim_S_Intel
Employee
575 Views
Hm, that seems like a typo to me... Does the code in 2.4(b) actually compile? I would think that the code in (a) is the correct version.
0 Kudos
newport_j
Beginner
575 Views

I do not know it looks like incomplete code so I can only guess. I thought it was a typo, but I just do not know.

Do you have the correct version?

Thanks in advance.

Newport_j

0 Kudos
Reply