CILK_NWORKERS parameter in multicore processor

CILK_NWORKERS parameter in multicore processor

Very strange, but if I set CILK_NWORKERS to 1 in my Core 2 Duo processor, I get same time, as CILK_NWORKERS=2. And I see in task manager that 2 cores are works.I want to execute Cilk++ program with 1 thread(worker) and compare result with 2 threads(workers). I print this parameter in my program with __cilkrts_get_nworkers() function and it's sets correctly.Anybody knows what really happens if I set CILK_NWORKERS? It's seems that Cilk++ dont use this parameter as follows.

10 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

I tried this parameter on Xeon L5520 (4 cores and 8 threads). In this case this parameter influenced on program execution time.I think that Cilk++ use at least 2 workers: master and second, regardless CILK_NWORKERS sets to 1 or 2, and CILK_NWORKERS sets number of second workers. Is this correct? Or maybe worker use multiple cores? Is this any way to execute program with really one worker?

We've recently identified an error in this area. Which release are you working on? Which OS?

- Barry

icpc -vVersion 12.0.4Ubuntu 10.10

Version 12.0.4 does indeed have the bug that causes it to temporarily use one extra worker. A fix is scheduled for the next release.The only way to get accurate timing results with 12.0.4is to start your timer after the extra worker has shut itself down. The following code should work:

_Cilk_spawn []{}(); // Forces Cilk runtime to start up
// Start timer here
// Execute parallel code
// Stop timer here

If you put the first two lines into main(), then you will not need to repeat them anywhere else.

BTW, you are clearly using thenewest Intel Parallel Composer, not the (unsupported) Intel Cilk++ compiler. I recommend that you post future questions to the Cilk Plus forum: There, you will find answers appropriate to the compiler you are using and tap into a larger Intel compiler community.

I dont understand what is this "_Cilk_spawn []{}();" and I got compilation error on this.
I tried "cilk_spawn foo()" before timer starts, where foo is:void foo() { sleep(1);}and this is got me slower result, but I'm not shure is this correct or not.

Pablo's fix uses a lambda function, which is one of the new features of C++0x. You can enable them using the -Qstd=c++0x option.

You did the same thing with your foo() function, which was correct.

- Barry

How does one set this option in Linux? I am using icpc version 12.1.0.
My compiled program is othello.
I tried "othello -CILK_NWORKERS=2", but it __cilkrts_get_nworkers() still reports 4 (I am running on a QuadCore).

Hi ScottK,
You can type the following on the command-prompt:

CILK_NWORKERS=2 ./othello


Balaji V. Iyer.

Of course, if you want to set it "for a while," you can alsouse:


- Barry

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!