Using a multicore-processor

Discussion in 'C++' started by Obnoxious User, Aug 29, 2008.

  1. On Fri, 29 Aug 2008 11:07:36 +0200, Peter Graf wrote:

    > Hi,
    >
    > I want to use to quadcore processor to calculate a matrix with a
    > C++-program. The elapsed time for calculating one entry is very variably
    > (approx. 1-30 min) and I'm not able to estimate the time before the
    > calculation.Therefore simply splitting the matrix in four blocks and
    > calculated each on one core will not use efficiently the processor.
    > Hence my question, is there is a (simple) way to modify a program, which
    > use now only one core in a way that it will be able to use all four
    > cores, so that the entries will be calculated one after another.
    >


    http://en.wikipedia.org/wiki/Parallel_programming

    --
    OU
    Obnoxious User, Aug 29, 2008
    #1
    1. Advertising

  2. Obnoxious User

    Peter Graf Guest

    Hi,

    I want to use to quadcore processor to calculate a
    matrix with a C++-program. The elapsed time for
    calculating one entry is very variably (approx.
    1-30 min) and I'm not able to estimate the time
    before the calculation.Therefore simply splitting
    the matrix in four blocks and calculated each on
    one core will not use efficiently the processor.
    Hence my question, is there is a (simple) way to
    modify a program, which use now only one core in a
    way that it will be able to use all four cores, so
    that the entries will be calculated one after another.

    Thanks in advance
    Peter
    Peter Graf, Aug 29, 2008
    #2
    1. Advertising

  3. Peter Graf <Graf@_nospam_gmx.de> writes:

    > Hi,
    >
    > I want to use to quadcore processor to calculate a matrix with a
    > C++-program. The elapsed time for calculating one entry is very
    > variably (approx. 1-30 min) and I'm not able to estimate the time
    > before the calculation.Therefore simply splitting the matrix in four
    > blocks and calculated each on one core will not use efficiently the
    > processor.
    > Hence my question, is there is a (simple) way to modify a program,
    > which use now only one core in a way that it will be able to use all
    > four cores, so that the entries will be calculated one after another.


    Instead of splitting it in 4, split it in 16 or 256, etc. Then you
    will have more, smaller jobs to feed your cores with, and you will be
    able to keep them all busy till the end. However, you will lost more
    time scheduling these tasks, so you shouldn't split it in too many jobs.

    --
    __Pascal Bourguignon__
    Pascal J. Bourguignon, Aug 29, 2008
    #3
  4. Obnoxious User

    Ian Collins Guest

    Peter Graf wrote:
    > Hi,
    >
    > I want to use to quadcore processor to calculate a matrix with a
    > C++-program. The elapsed time for calculating one entry is very variably
    > (approx. 1-30 min) and I'm not able to estimate the time before the
    > calculation.Therefore simply splitting the matrix in four blocks and
    > calculated each on one core will not use efficiently the processor.
    > Hence my question, is there is a (simple) way to modify a program, which
    > use now only one core in a way that it will be able to use all four
    > cores, so that the entries will be calculated one after another.
    >

    Check out OpenMP, most (if not all) decent compilers support it.

    http://en.wikipedia.org/wiki/OpenMP

    --
    Ian Collins.
    Ian Collins, Aug 29, 2008
    #4
  5. Obnoxious User

    ankur saxena Guest

    On Aug 29, 2:57 pm, Ian Collins <> wrote:
    > Peter Graf wrote:
    > > Hi,

    >
    > > I want to use to quadcore processor to calculate a matrix with a
    > > C++-program. The elapsed time for calculating one entry is very variably
    > > (approx. 1-30 min) and I'm not able to estimate the time before the
    > > calculation.Therefore simply splitting the matrix in four blocks and
    > > calculated each on one core will not use  efficiently the processor.
    > > Hence my question, is there is a (simple) way to modify a program, which
    > > use now only one core in a way that it will be able to use all four
    > > cores, so that the entries will be calculated one after another.

    >
    > Check out OpenMP, most (if not all) decent compilers support it.
    >
    > http://en.wikipedia.org/wiki/OpenMP
    >
    > --
    > Ian Collins.


    hey hi,
    I recently used MPICH 2 , its an API used to compile and run a C / C++
    programm on Multiple processors, but each processor was on different
    machine( this is parallel computing, but i guess ur problem stricly
    needs parallel PROGRAMMING , i.e u just need to code in a way to
    divide ur matrix ( more specifically the JOBS like "for loops" into
    chunks and use system calls to direct each chunk of jobs to each
    processor, hopefully the link by " OU ", would be of great help to
    you) . And seach for it, there must be some library or API to DO above
    for C++ or VC++ . and if you are done and manage to make this
    programm( i am sure u will) , Please if you dont mind , mail me your
    program, and if possible with some description, i want to see hows it
    all works. please mail me at

    Thanx peter
    ankur saxena, Aug 29, 2008
    #5
  6. Juha Nieminen, Aug 29, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dimitri Ognibene

    java vm and multicore

    Dimitri Ognibene, Apr 27, 2006, in forum: Java
    Replies:
    1
    Views:
    493
    Daniel Dyer
    Apr 27, 2006
  2. brahatha
    Replies:
    1
    Views:
    648
  3. Neo
    Replies:
    4
    Views:
    362
    Joe Seigh
    Jan 31, 2008
  4. finecur
    Replies:
    12
    Views:
    1,202
    Juha Nieminen
    Feb 3, 2008
  5. Marc Hoeppner

    Using multicore CPUs in parallel tasks

    Marc Hoeppner, Oct 29, 2009, in forum: Ruby
    Replies:
    18
    Views:
    177
    James M. Lawrence
    Nov 3, 2009
Loading...

Share This Page