cannot find main?

cannot find main?

Istarted to cilkify my program with an error serial program. I took the line that said

int main()

and changed it to

int cilk_main()

I also aded the include file

cilk.h this way

include

Iadded the line at the bottom of my include file list for the main function. I am not sure why I must precede it by

cilk/

,but I did.

I then got the error

ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crtl1.o(.debug_info): relocation 0 has invalid symbol index 12

several more lines similar

/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../crtl.o: In function " _start':
(.text+ox18): undefined reference to "main"

I did not change any file extensions from *.c to *.cilk.I am usng icc and it compiles all files with a c extension fine.

The compiler seems to believe that i do not have a main function. I changed theint main() to int cilk_main().
When I compiled I got the output that I listed above. What did I do wrong? I did everything that it said to do on the Cilk++ Programmers Guide.

Thanks in advance.

Newport_j

5 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Cilk++ is not the same as Intel Cilk Plus. icc supports Cilk Plus, not Cilk++. As such, do not use the programmers guide. Instead refer to the documentation in the compiler user's guide and reference and to the samples provided in the cilk subdirectory.

In this case, I would just recommend renaming cilk_main back to main and see if that works.

Brandon Hewitt
Technical Consulting Engineer

For 1:1 technical support: http://premier.intel.com

Software Product Support info: http://www.intel.com/software/support

I was using the Intel Cilk SDKguide page 14. I just started rewriting a serial program to a cilk parallell program. Since my code is in c, I thought that this Intel Cilk manual applies.

Since, I posted my question, I thought about the problem. At first, I named int main() to int cilk_main, but I did not change the file extension from *.c to *.cilk. This the icc compiler is treating this as straight c code, and does not undertstand cilk_main(). Hence, it claims that I do not have a main function. Maybe I should give the file that contains a main function, the file extension *.cilk.

I did not understand your first sentence in your reply. I have switched exclusivley to Intel Cilk Plus. Thus the changes thta I madeare outlined on page 14 of the Programmer's Guide.

I will try your recommendation. But please elaborate on the first sentence in your reply. I have removed all previous versions of cilk from my hardrive.

If I change cilk_main() back to main(), then how will icc know my code is cilk? I assume that I still must have #include in the header section.

I am using the icc command to compile my c source code.

Newport_j

Yes, I see your point. I was using the wrong manual for Intel's Cilk compiler. Sorry, I have talken the Cilk Arts documents out of my notebook.

You are correct in what you say. I have made modifications to avoid this in the future(see above).

Newport_j

The Intel Cilk Plus Tools User's Guide is only shipped as an HTML document, cilktools.html, so it doesn't have page numbers. However, I did find one stray reference to cilk_main. I've removed it and it will be fixed the next time we update the tools.

The Intel Cilk Plus documentation is available at http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/cpp/lin/index.htm#cref_cls/common/cilk_bk_using_cilk.htm If it contains any references to cilk_main, they're also an error. Please point me at the topic and I'll have it fixed.

If you look inside the version of cilk.h shipped with the Intel compiler, you'll see that there's very little there. Basically only macros to make using the Cilk keywords easier.

The icc compiler recognizes the use of the cilk_spawn keyword and marks your function as a "spawning function". That means that it will allocate a __cilkrts_stack_frame in the function and do the appropriate things to initialize it in the function prologue and tear it down in the function epilogue.

- Barry

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi