About Parallelism - Linux

This is a discussion on About Parallelism - Linux ; 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 ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: About Parallelism

  1. About Parallelism

    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


  2. 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?


    You could write a test program that is compute-bound (i.e. it just does
    calculations in multiple threads, no I/O) and run it on various
    configurations (kernel parameter maxcpus=) and measure its execution
    time. If that doesn't vary with the number of CPUs in use, then your OS
    (or threading library) doesn't scale well.

    --
    These are my personal views and not those of Fujitsu Siemens Computers!
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize (T. Pratchett)
    Company Details: http://www.fujitsu-siemens.com/imprint.html


  3. Re: About Parallelism

    On Jul 11, 11:57 pm, Josef Moellers siemens.com> wrote:

    > You could write a test program that is compute-bound (i.e. it just does
    > calculations in multiple threads, no I/O) and run it on various
    > configurations (kernel parameter maxcpus=) and measure its execution
    > time. If that doesn't vary with the number of CPUs in use, then your OS
    > (or threading library) doesn't scale well.


    Most operating systems have a way to launch a program such that it can
    only use a single CPU. For example, on Linux, 'taskset' can do this.

    DS


  4. 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)?


    How about running a system monitor and verifying that the cpus are as
    busy as you expect?

    Chris

  5. 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


  6. Re: About Parallelism

    Iwo Mergler wrote:


    Thank you, Iwo. You are quite correct: the objdump's did not reveal any
    direct parallelism, though I can't speak for the syscalls.
    I was well aware of watching execution profiles, so perhaps I should
    have asked: how to ensure that mmulti-threading will assign multiple
    CPU's to my threads? But you have now answered that question as well.

    Thanks again,
    Scott
    =============

    : 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


    --
    Scott McCaughrin


+ Reply to Thread