Thread overview
Queue thread
Nov 20, 2011
bioinfornatics
Nov 20, 2011
Jonathan M Davis
Nov 20, 2011
bioinfornatics
Nov 21, 2011
Andrej Mitrovic
Nov 21, 2011
bioinfornatics
Nov 21, 2011
Kai Meyer
Nov 21, 2011
Andrej Mitrovic
Nov 22, 2011
Kai Meyer
Nov 20, 2011
Andrea Fontana
November 20, 2011
Dear,
I would like to know if they are a way to run run a queue thread an run
(nb core * 2 + 1) = nb thread in same time

something like:
size_t nb_core = 9;
Queue q = new Queue( 9, process1, process2, process3 );
q.run();

kind regards

November 20, 2011
On Sunday, November 20, 2011 11:59:14 bioinfornatics wrote:
> Dear,
> I would like to know if they are a way to run run a queue thread an run
> (nb core * 2 + 1) = nb thread in same time
> 
> something like:
> size_t nb_core = 9;
> Queue q = new Queue( 9, process1, process2, process3 );
> q.run();

Look at std.parallelism. I don't know if it'll do quite what you want, but it's the closest that you'll find in Phobos.

- Jonathan M Davis
November 20, 2011
This: http://www.d-programming-language.org/phobos/std_parallelism.html#TaskPool

?

bioinfornatics wrote:

> Dear,
> I would like to know if they are a way to run run a queue thread an run
> (nb core * 2 + 1) = nb thread in same time
>
> something like:
> size_t nb_core = 9;
> Queue q = new Queue( 9, process1, process2, process3 );
> q.run();
>
> kind regards

November 20, 2011
Le dimanche 20 novembre 2011 à 03:09 -0800, Jonathan M Davis a écrit :
> On Sunday, November 20, 2011 11:59:14 bioinfornatics wrote:
> > Dear,
> > I would like to know if they are a way to run run a queue thread an run
> > (nb core * 2 + 1) = nb thread in same time
> > 
> > something like:
> > size_t nb_core = 9;
> > Queue q = new Queue( 9, process1, process2, process3 );
> > q.run();
> 
> Look at std.parallelism. I don't know if it'll do quite what you want, but it's the closest that you'll find in Phobos.
> 
> - Jonathan M Davis


i have tred to use TaskPool but i fail
Error: /parallelism.d(434): Error: no property 'opCall' for type
'fastcgi.application.Page'

the problem raise here: https://github.com/bioinfornatics/DFastCGI/blob/master/src/fastcgi/application.d#L74 (i think)

Any help are welcome

thanks

November 21, 2011
Try
auto t = task(&page.run);

You can't pass a class method as a compile-time argument unless it's a static method.
November 21, 2011
Le lundi 21 novembre 2011 à 02:09 +0100, Andrej Mitrovic a écrit :
> Try
> auto t = task(&page.run);
> 
> You can't pass a class method as a compile-time argument unless it's a static method.

oh ok thanks :-)

November 21, 2011
On 11/20/2011 02:36 PM, bioinfornatics wrote:
> Le dimanche 20 novembre 2011 à 03:09 -0800, Jonathan M Davis a écrit :
>> On Sunday, November 20, 2011 11:59:14 bioinfornatics wrote:
>>> Dear,
>>> I would like to know if they are a way to run run a queue thread an run
>>> (nb core * 2 + 1) = nb thread in same time
>>>
>>> something like:
>>> size_t nb_core = 9;
>>> Queue q = new Queue( 9, process1, process2, process3 );
>>> q.run();
>>
>> Look at std.parallelism. I don't know if it'll do quite what you want, but
>> it's the closest that you'll find in Phobos.
>>
>> - Jonathan M Davis
>
>
> i have tred to use TaskPool but i fail
> Error: /parallelism.d(434): Error: no property 'opCall' for type
> 'fastcgi.application.Page'
>
> the problem raise here:
> https://github.com/bioinfornatics/DFastCGI/blob/master/src/fastcgi/application.d#L74 (i think)
>
> Any help are welcome
>
> thanks
>

I looked at your code, and saw this:
https://github.com/bioinfornatics/DFastCGI/blob/master/src/fastcgi/application.d#L18
_taskPool   = new TaskPool( totalCPUs * threadsPerCPU + 1);

On my machine, that would come out to 1:

[kai.meyer@kai-rhel6 D]$ cat cpu.d
import std.stdio;
import std.parallelism : totalCPUs, TaskPool, task;
import std.cpuid : threadsPerCPU;

void main()
{
    writefln("totalCPUs %s", totalCPUs);
    writefln("threadsPerCPU %s", threadsPerCPU);
    writefln("totalCPUs * threadsPerCPU + 1 = %s\n", totalCPUs * threadsPerCPU + 1);
}
[kai.meyer@kai-rhel6 D]$ dmd -run cpu.d
totalCPUs 8
threadsPerCPU 0
totalCPUs * threadsPerCPU + 1 = 1

Did you mean this?
_taskPool   = new TaskPool( totalCPUs * (threadsPerCPU + 1));
November 21, 2011
How come you don't have any threads per CPU? I guess this is a difference between multi-processor and multi-core machines maybe?
November 22, 2011
On 11/21/2011 11:27 AM, Andrej Mitrovic wrote:
> How come you don't have any threads per CPU? I guess this is a
> difference between multi-processor and multi-core machines maybe?

I don't know, I'm not much of a hardware guy.

Here's the 8th CPU's entry from /proc/cpuinfo. This is a Dell Optiplex 980

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 30
model name	: Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz
stepping	: 5
cpu MHz		: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id		: 3
cpu cores	: 4
apicid		: 7
initial apicid	: 7
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5585.03
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management: