Cilk++ with CLAPACK issue

Cilk++ with CLAPACK issue


I'm interested in using Cilk++ to parallelize matrix operations with CLAPACK.

I am new to both Cilk++ and CLAPACK. However, I've been able to write example programs with each package separately, but now that I'm trying to combine them I'm running into problems. After looking in vain with Google I decided it was time to ask the experts.

When I try to compile a program using both CLAPACK and Cilk++ I get the following error:

../lapack/CLAPACK-3.2.1/F2CLIBS/libf2c.a(main.o): In function `main':
(.text+0x87): undefined reference to `MAIN__'

As far as I can tell, libf2c expects a symbol named MAIN__ to identify where my C++ program starts, but this symbol isn't present in Cilk++ because Cilk++ uses cilk_main to specify a special entry point. I've looked at the offending f2c library file and it appears to just define conversions between what fortran expexts and c expects.

I've tried bracketing the include files which reference libf2c with the CILK_BEGIN_CPLUSPLUS_HEADERS and CILK_END_CPLUSPLUS_HEADERS macros, but the same error was given.

I also tried recompiling the f2c library with the version of gcc provided with Cilk++.

I suppose at this point I'm not sure if I'm missing something I should be doing or if these two packages are just at odds with one another.

Unless I'm doing something wrong I guess the quickest fix for me would be to ask if Cilk++ defines a symbol similar to MAIN__ that I can use to recompile my f2c library.

I'm using Cilk++ version 8503-x86_64. I would include my source but it happens whenever I use cilk_main instead of main, so I don't think it'd be helpful. I used the following compiliation string:

cilk++ -o blockChol3 -Wall -O0 blockChol3.cilk 


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


It looks like the best way for you to work this is to use main() instead of cilk_main(). In order to do that, you must move most of your main function into a separate function, then call that function using clk::run(). So, if you had:

int cilk_main(int argc, char** argv)
// Do my work

You would change that to:

int my_main(int argc, char** argv)
// Do my work

int main(int argc, char** argv)
return cilk::run(&my_main, argc, argv);

Let us know whether that works for you.
- Pablo


Using the above I was able to compile and run my code.


Leave a Comment

Please sign in to add a comment. Not a member? Join today