[Beowulf] Threaded code - top

Mark Hahn hahn at physics.mcmaster.ca
Tue Aug 17 10:47:34 PDT 2004


On Tue, 17 Aug 2004, Art Edwards wrote:
> Is it conceivable to run a threaded code on a dual system and see
> activity on only one processor (assuming atlas has been compiled
> correctly?)

sure.  the kernel (which one, by the way?) has some heuristics 
that it uses to distribute threads across processors.  these heuristics 
may well not be working well for you, especially if your threads are 
short-lived.  I didn't look to see whether Atlas uses a thread pool
(which would amortize thread startup cost, but could actually hurt 
the cpu-wise distribution of threads, since the kernel regards fork/clone
and exec as particularly attractive events to migrate threads...)

> Is it conceivable to run a threaded code on a dual system and see
> activity on only one processor (assuming atlas has been compiled
> correctly?)

sure.  the kernel may not have migrated the thread to the other CPU,
your "top" could be broken, the parallel section too brief to see, etc.

> Incidentally, we compiled our own atlas with pthreads enabled (we
> think). 

strace or ltrace are astonishingly useful for telling what the program
is actually doing...  in particular, note the -e switch to make the output
managable...

regards, mark hahn.




More information about the Beowulf mailing list