Hi Zak,

It seems very weird that my version of fac changes performance
characteristics on my machine and not yours (OS/hardware dependent?).
Can you tell your hardware configuration, esp. number of physical and
logical cores? I am planning next to leave out using pmap and just try
to run the thing using threads directly.  Also write up the same
implementation in Java and compare.  Will do that next when I have
some time to spend on it.

Reg. partitioning -

You won't see any appreciable difference between partition-all and
partition-work in a few examples.  But I'm quite sure that overall on
an average partition-work will divide up the work in a much more
balanced fashion than partition-all.  Imo partition-all is intended
for a different purpose than dividing a coll "equally".

partition-work guarantees (prove it!) that the number of elements in
each sub-coll is bounded above by ceil(n/p) and bounded below by
floor(n/p). n=count of coll, p=num of sub colls to divide into.

Example - suppose need to partition 13 tasks (taking roughly equal
amount of time) onto 4 CPUs.

1:345 user=> (partition-work 4 (range 13))
((0 1 2) (3 4 5) (6 7 8) (9 10 11 12))

1:346 user=> (clojure.core/partition-all 4 (range 13))
((0 1 2 3) (4 5 6 7) (8 9 10 11) (12))

If we just use partition-all (w/o any modifications) it puts 4 tasks
each on 3 CPUs and only 1 task on the last CPU.  But partition-work
will divide - 3 tasks on the first 3 CPUs and 4 tasks on the last CPU;
leading to a more balanced work division.

Also as stated above you cannot use partition-all (directly in its
current form) to divide up 9 tasks among 4 cores -

(1:335 user=> (clojure.core/partition-all 2 (range 9))
((0 1) (2 3) (4 5) (6 7) (8))
1:336 user=> (clojure.core/partition-all 3 (range 9))
((0 1 2) (3 4 5) (6 7 8))

1:338 user=> (partition-work 4 (range 9))
((0 1) (2 3) (4 5) (6 7 8))

- Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to