Re: About Parallelism
- From: Iwo Mergler <Iwo.Mergler@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 Jul 2007 09:43:52 +0100
Scott J. McCaughrin wrote:
I have a multi-CPU machine, but I suspect my compilers may not be
taking advantage of parallelism. Yes, I am doing penty of multi-
threading, but how can I make sure that the implementation is
actually making use of the multiple CPU's (Xeons)?
As a brute-force approach, I could 'objdump' my pthreads library
and study its gas code to see what happens. Is there a less tedious
alternative?
Thanks, Scott
Hi Scott,
you will not find any parallel magic in the objdump output.
Modern PC processor cores depend on deep pipelines and caches
for their performance. This makes it very expensive to split
a program across multiple cores in the way you seem to expect.
Thus, compilers for PCs compile programs for a single core.
The parallelism is implemented by the OS at thread/task level.
If you have a multi-threaded program, the OS will distribute
the active threads over different cores.
Please note the keyword here is 'active'. Most programs have
rarely more than two active threads at any time.
As Josef said, if your aim is to load all your CPUs to 100%,
write a bunch of computing threads, each operating on their
own variables and without I/O. The OS will distribute them
among the cores.
The world you described, where the compiler extracts intrinsic
parallelism from a program and distributes it across cores,
does indeed exist. These methods are used heavily with vector
processors, signal processors, media processors, GPUs, etc.
These architectures are specifically designed for fine-grained
parallelism. PCs are not.
Kind regards,
Iwo
.
- Follow-Ups:
- Re: About Parallelism
- From: Scott J. McCaughrin
- Re: About Parallelism
- References:
- About Parallelism
- From: Scott J. McCaughrin
- About Parallelism
- Prev by Date: char device driver and bus ?
- Next by Date: Re: char device driver and bus ?
- Previous by thread: Re: About Parallelism
- Next by thread: Re: About Parallelism
- Index(es):
Relevant Pages
|