Visual studio 2010 errors

Visual studio 2010 errors

Ritratto di szentejan

Hi.sorry for the bad english it's not my native languauge. I just started to discover cilk plus,but I'm already stucked. I got visual studio 2010 on my win 7. I installed intel parralell composer 2011 xehttp://software.intel.com/en-us/articles/intel-parallel-studio-xe/ Also installed cilk sdkhttp://software.intel.com/en-us/articles/intel-cilk-plus-software-development-kit/ After then I started new project set the compiler to intel c++, and checked the settings like enable cilk keywords etc, as they are in the tutorial. When I use the cilk keywords, my visual studio says
1 IntelliSense: identifier "_Cilk_spawn" is undefined But i can run the program after all. I implented the two version of fibonachi. the one with serial,and the one with parralel programing. I put a timer on the code, but after a couple of tests, the one with cilk words seems slower,than the serial one.I tested them on two different pc with different dual core processors.Pls Can anybody help me, what am i doing wrong? here are my codes. Parralel with cilk keywords: int Pfib(int n) { if(n <= 1) { return n; } else { int x,y; x = _Cilk_spawn Pfib(n-1); y = Pfib(n-2); _Cilk_sync; return x + y; } } int _tmain(int argc, _TCHAR* argv[]) { int n, result; n = 40; LARGE_INTEGER frequency; // ticks per second LARGE_INTEGER t1, t2; // ticks double elapsedTime; // get ticks per second QueryPerformanceFrequency(&frequency); // start timer QueryPerformanceCounter(&t1); /// result = Pfib(n); /// QueryPerformanceCounter(&t2); // compute and print the elapsed time in millisec elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; cout << elapsedTime << " ms.\\n"; /// printf ("Result: %d\\n", result); system("PAUSE"); return 0; } Serial: int fib (int n) { if (n<2) return (n); else { int x, y; x = fib (n-1); y = fib (n-2); return (x+y); } } int main (int argc, char *argv[]) { int n, result; n = 40; /// LARGE_INTEGER frequency; // ticks per second LARGE_INTEGER t1, t2; // ticks double elapsedTime; // get ticks per second QueryPerformanceFrequency(&frequency); // start timer QueryPerformanceCounter(&t1); /// result = fib (n); /// QueryPerformanceCounter(&t2); // compute and print the elapsed time in millisec elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; cout << elapsedTime << " ms.\\n"; printf ("Result: %d\\n", result); system("pause"); return 0; }

5 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Barry Tannenbaum (Intel)
Best Reply

Your code looks fine. I'll forward the comment about Intellisense to the folks that work on Parallel Studio's integration into Visual Studio.

It isn't surprising that the serial version is faster than the parallel version.Remember that there is overhead associated with using a _Cilk_spawn.The goal is to amortize that overhead against work that you're performing in parallel. Parallel fib() is pretty much the definition of all overhead since it does so little work.

- Barry

Ritratto di Barry Tannenbaum (Intel)

P.S. You don't need to write a parallel and serial version of your program. You can use the compiler option /Qcilk-serialize to have the compiler automatically pull in cilk_stub.h which replaces the Cilk keywords with their serial equivalents.

Ritratto di Barry Tannenbaum (Intel)

I checked with the folks doing Visual Studio integration. Unfortunately Microsoft does not provide a way to add keywords to Intellisense, so we cannot fix this.

- Barry

Ritratto di Sergey Kostrov

>>...Unfortunately Microsoft does not provide a way to add keywords to Intellisense, so we cannot fix this...

Could you take a look at the article:

"Visual Studio 2010 Adding Intellisense Support for CUDA C"

The link is:

http://www.ademiller.com/blogs/tech/2010/10/visual-studio-2010-adding-intellisense-support-for-cuda-c/

Accedere per lasciare un commento.