Re: About Parallelism



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

.



Relevant Pages

  • Re: The Emperors new clothes
    ... >>> Apps that make limited explicit use of parallelism may ... transistors is to simply add cores. ... And remember that what an extremely talented programmer can do is, ... barrel of sewage, you get sewage. ...
    (comp.arch)
  • Re: Speed wars 3: OCaml, F#, Clojure, Pascal
    ... no one else was able to reproduce your results running your OCaml ... Florian only ran his parallel version on 2 cores before concluding ... that GHC's support for scalable parallelism was superb. ... You have concluded that Haskell performs "very well" despite the fact ...
    (comp.lang.functional)
  • Re: Speed wars 3: OCaml, F#, Clojure, Pascal
    ... no one else was able to reproduce your results running your OCaml ... Florian only ran his parallel version on 2 cores before concluding ... with GCC and without using advanced parallelism (e.g. ... while loop in the OCaml version... ...
    (comp.lang.functional)
  • Re: About Parallelism
    ... Thank you, Iwo. ... direct parallelism, though I can't speak for the syscalls. ... a program across multiple cores in the way you seem to expect. ... compilers for PCs compile programs for a single core. ...
    (comp.os.linux.development.system)
  • Re: Parallel processing on graohics chips
    ... why do we still use compilers that really only work well wiith a ... single core CPU? ... amount of parallelism to work with, but your problem has to fall into ... and if parallelisation as a language concept is rather a bolted-on ...
    (comp.lang.fortran)