- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'am trying to parallelise my program usng _Cilk_spawn and _Cilk_sync, the program compilese with Intel C++ compiler but these keywors are underlined with red and aren't recognized so i don't get parallelism in my program. Also i changed my Intel Composer to "use Intel C++" so thats not the problem. Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know about ICC, but have you included the cilk libraries and linked agains them? So something like:
icc <yourprog.c> -o prog -libcilkrts -fcilkplus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also i forgot to say that this happens in Visual Studio 2010, and yes i have included cilk libraries. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let me get this right. You say: "the program compilese with Intel C++ compiler but these keywors are underlined with red". So your program *does* compile, it seems. Can you run it? I don't use VS (Linux here), but it may be the case that the VS C++ semantics analyzer is not picking up the cilk keywords because they are not part of its understanding of C++? If so, you can just ignore the lines and continue. But maybe the other guys running VS here will be able to pick this up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes i can run it, i just don't have parallelism, program executes serial.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Leo, Unlike GCC, the Cilk features are enabled by default in the Intel compiler.
From your description, I'm going to assume that you're working on Windows. Create an "Parallel Studio with Intel Compiler" command prompt window, and execute the command
icl /version
You should see something like
Intel(R) C++ Compiler XE for applications running on IA-32, Version 13.0.1.119 Build 20121008
The Cilk keywords were introduces in Intel C++ Composer 12.0.
Another thing to check is to look at the build log Visual Studio creates. After the build completes, go to the Output window, hold down the Control key and click on the underlined file at the bottom of the window. For example:
1>Build log was saved at "file://C:\Users\bmtannen\tests\reducer-demos\reducer-min-index-demo\Debug\BuildLog.htm"
That should bring up a window with "Build Log" at the top on a grey background. Look for one of the compilation lines. You should see something like:
Creating temporary file "C:\Users\bmtannen\AppData\Local\Temp\RSPF1B7.bs" with contents
[
/c /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /EHsc /RTC1 /MDd /GS /fp:fast /Fo"Debug/" /Fd"Debug/vc90.pdb" /W3 /nologo /ZI /Qvc9 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\bin"
.\reducer-min-index-demo.cpp
]
Creating command line "icl.exe "@C:\Users\bmtannen\AppData\Local\Temp\RSPF1B7.bs""
icl is the Intel compiler. If it says instead, "Creating command line cl.exe..." you're still using Microsoft's compiler.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't use /Qcilk-serialize option, but now i have try it and it is the same.
It is multi-core system, and the Composer is Intel Composer_xe_2013_update3.
Thanks ,
Nemanja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please do a build and attach your build log.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say that your program is executing serially, how are you arriving at this conclusion? How long does the program take to run, and what does the code that you are running look like? Are you running something like "fib"?
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah. It seems to me that your system is recognizing Cilk keywords and is compiling correctly, but you are not seeing parallel speedup when your program is run using more than one worker. That would be a slightly different problem than what it sounded like originally.
Can you describe the approach you are taking to parallelize your code or post some code samples that illustrate the problem? How long does the code take to run, using 1 vs. 2 workers? It is possible that you are running into issues with have parallelism that is too fine-grained, which would be consistent with the behavior you are seeing. Alternatively, there could be some sharing (either false or true) of data that is causing performance degradation.
Without having more information about the program, though, it is hard for us to tell what might be happening.
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't use any of cilk functions, when i write them somethig like "__cilkrts_set_param("nworkers", "2"); " it is not recognized as command, but my code compiles besides that and works. I tried it on a big scale with 1000x1000 board but i get, as i sad, roughly the same time. I think the problem has something to do with my Parallel Studio.
so this is my parallel function:
[cpp]void GameOfLife::nextIterParallel()
{
unsigned char* new_buffer = new unsigned char [m_width * m_height];
for(int row=0; row<m_height; ++row) {
_Cilk_spawn checkRow(new_buffer, row);
}
_Cilk_sync;
m_buffer = new_buffer;
}[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I see what you were saying about things unrecognized. To use the Cilk functions such as __cilkrts_set_param, you must include <cilk/cilk_api.h>. Some example Cilk programs you see online may forget to include this file, because some current versions of the compiler will accept Cilk API functions anyway without complaining about the missing header file. But this behavior is technically a bug, and you should not rely on it working in future versions.
It is more efficient to use a "cilk_for" in your case, instead of spawning each "checkRow" call serially.
cilk_for(int row=0; row<m_height; ++row) {
checkRow(new_buffer, row);
}
Does that improve your performance a bit? Depending on how much work is done in "checkRow", that may or may not be enough for you to see speedup.
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I included it and it is still the same, the functions are undefined, my parallel function is working serial. I agree that cilk_for is much suitable solution, but this is school project and they are letting us use only spawn and sync to parallelise our code.
Thanks, Nemanja.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might want to try the Cilk tools. The Windows version integrates with Visual Studio. Documentation is provided with the kit as an HTML file.
First I'd try the Cilkscreen race detector. If you've got sharing in your application, that will definitely effect performance. Once you are sure your application is race free, I'd try the Cilkview scalability analyzer, which will give you an estimate of how much parallelism you've exposed in your program.
The Cilk tools are available at http://cilkplus.org/download . You'll want the "Intel Cilk Plus SDK".
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm, I'm not quite sure why you wouldn't be able to compile a program using __cilkrts_set_param. But without the error messages it is hard to tell. Perhaps it is something different about your setup that we aren't able to reproduce.
It is possible to implement cilk_for efficiently using only cilk_spawn and cilk_sync. But since you are working on a school project, I won't deprive you of the fun of figuring it out for yourself. :)
Cheers,
Jim
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page