Hi,
I'm new to Lisp programming and SBCL, and I'm currently facing some
problems on using sbcl threads library.
I'm running some simple computation, such as computing the sum of a
list of one million integers in a reduction fashion. I would like to
parallelize the sum by using threads. Therefore, I usually create
about 2-4 threads, each computes a portion of the sum. The results are
always correct, however, I found the performance is always as fast as
my sequential version. Then I looked at the CPU monitor, and it shows
that when doing computation using threads, all the threads only occupy
the first core, and very seldomly occupy the second core. I read the
SBCL manual, and googled on websites but seems I could not find the
answer.
My machine is a Dual-core x86-64-fedora12 box, with 4gb memory. Later,
I thought it maybe due to the gc. Therefore I used the command:
(sb-ext:bytes-consed-between-gcs)
And found that the default value is 12582912, I tried to make it
larger to 512mb (also tried other values) by using
(setf (sb-ext:bytes-consed-between-gcs) (- (expt 2 29) 10)))
Then run my multithreading program again, and still, all the threads
occupy one of the two cores when running, and the speed up is very
trivial.
Here did I miss something on configuring the GC? or I am totally out
of the correct direction?
Thanks for your help,
Cheers,
Yue
|