puzzled about 'peach'...

Hi,

I’ve tried to take advantage of a multi-core machine (4 CPUs), and run
in parallel a CPU intensive function.

I hoped using ‘peach’ the calculation will be faster, at the expense
of the CPU% going up.
I’ve only noticed the CPU usage increase, but the calculation time
actually went up.
(from about 7 sec using ‘each’ to about 17 sec using ‘peach’…)

How can this be explained?

Regards,
PM

$> q -s 4
KDB+ 2.7 2010.12.06 Copyright (C) 1993-2010 Kx Systems
l64/ 4()core 7972MB …

q)\s
4

q)f:{do[10000000;a:1+1]}

q)\t f
1574

q)\t f each 1 2 3 4 / CPU = 25% in ‘top’ command; it makes sense, it
is about 4 times longer than individual call…
7000

q)\t f peach 1 2 3 4 / CPU = 100%; ok but why does it take (much)
longer to complete?!
17230

$> grep processor /proc/cpuinfo
processor : 0
processor : 1
processor : 2
processor : 3

A polite reminder - Google groups is intended for non-commercial users; the k4 listbox is intended for licensed customers.

scalar ops will dominate ref count adjustments which block other threads.

Vector oriented ops should scale better

e.g.

\t {sum exp x?1.0} each 2#1000000