Using the taskset command I demonstrate that my benchmarks run on one processor.
Recently Russ raised a question: are my wall clock times wrong
because I have many processors on my machine. I believe that the answer
is no.
Firstly, without special efforts, linux has no way of breaking a process
onto more than one processor. When I run my benchmarking program,
tst_ar4, I see from the top command than one processor goes to > 90%
use, and all the others remain at 0%.
Secondly, I confirmed this with the taskset command, which I had never
heard of before. It limits a process to one (or any other number) of
processors. In fact, it lets you pick which processors are used. Here's
some timing results that show I get about the same times using the
taskset command as I do without it, on a compressed file read:
bash-3.2$ sudo ./clear_cache.sh && ./tst_ar4 -h -c 35000000 \
bash-3.2$ pr_A1_z1_64_128_256.nc
cs[0] cs[1] cs[2] cache(MB) deflate shuffle 1st_read_hor(us) avg_read_hor(us)
64 128 256 33.4 1 0 304398 4568
bash-3.2$ sudo ./clear_cache.sh && taskset -c 4 ./tst_ar4 -h -c 35000000 \
bash-3.2$ pr_A1_z1_64_128_256.nc
cs[0] cs[1] cs[2] cache(MB) deflate shuffle 1st_read_hor(us) avg_read_hor(us)
64 128 256 33.4 1 0 306810 4553
bash-3.2$ sudo ./clear_cache.sh && ./tst_ar4 -h -c 35000000 \
bash-3.2$ pr_A1_z1_64_128_256.nc
cs[0] cs[1] cs[2] cache(MB) deflate shuffle 1st_read_hor(us) avg_read_hor(us)
64 128 256 33.4 1 0 292707 4616
bash-3.2$ sudo ./clear_cache.sh && taskset -c 4 ./tst_ar4 -h -c 35000000 \
bash-3.2$ pr_A1_z1_64_128_256.nc
cs[0] cs[1] cs[2] cache(MB) deflate shuffle 1st_read_hor(us) avg_read_hor(us)
64 128 256 33.4 1 0 293713 4567
I stumbled on this post when I was trying to find related data on coding and I find this quite interesting though quite complicated to me.
Posted by 75.71.9.118 on February 03, 2010 at 06:14 AM MST #