Parallel Quicksort 1.0 is here.

Discussion in 'C++' started by aminer, Aug 18, 2012.

  1. aminer

    aminer Guest

    Hello,

    Parallel Quicksort 1.0 is here.


    Description:

    Parallel Quicksort that uses my threadpool engine.

    Parallel Quicksort gave me 3x scaling when sorting strings on a quad cores,
    it scales better than the parallel quicksort in the parallelsort library..

    Please use Lazarus-1.1-38262-fpc-2.6.1 from
    http://mirrors.iwi.me/lazarus/snapshots / cause it scales better on this
    version.


    Hello,

    It is easy to use parallel quicksort , you can sort strings , integers ,
    reals, doubles etc
    you can even sort them when they are inside objects.

    Here is an example that i gave you inside the zip file, i am sorting strings
    that are inside objects:

    :
    ---

    program test;

    uses parallelquicksort,sysutils,timer;

    type

    TStudent = Class
    public
    Name: string;
    end;
    ?
    var tab:Ttabpointer;
    myobj:TParallelSort;
    student:TStudent;
    i:integer;


    function comp(Item1, Item2: Pointer): integer;

    begin

    if TStudent(Item1).name < TStudent(Item2).name
    then
    begin
    result:=-1;
    exit;
    end;

    if TStudent(Item1).name > TStudent(Item2).name
    then
    begin
    result:=1;
    exit;
    end;

    if TStudent(Item1).name = TStudent(Item2).name
    then
    begin
    result:=0;
    exit;
    end;
    ?
    end;

    begin

    myobj:=TParallelSort.create(4); // set to the number of cores...

    setlength(tab,100000);

    for i:=low(tab) to high(tab)
    do
    begin
    student:=TStudent.create;
    student.name:= inttostr(i);
    tab[high(tab)-i]:= student;
    end;
    ?
    HPT.Timestart;

    myobj.pqsort(tab,comp);

    writeln;
    writeln('Time in microseconds: ',hpt.TimePeriod);
    ?
    writeln;

    writeln('Please press a key to continu...');

    readln;

    for i := LOW(tab) to HIGH(Tab)
    do
    begin
    writeln(TStudent(tab).name,' ');
    end;

    for i := 0 to HIGH(Tab) do freeandnil(TStudent(tab));
    setlength(tab,0);
    myobj.free;

    end.

    ---



    Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

    or Lazarus 32 bits or 64 bits from:

    http://mirrors.iwi.me/lazarus/snapshots/

    Operating Systems: Win , Linux and Mac (x86).


    You can download parallelquicksort from:

    http://pages.videotron.com/aminer/



    Thank you,
    Amine Moulay Ramdane.
    aminer, Aug 18, 2012
    #1
    1. Advertising

  2. aminer

    aminer Guest

    Hello,

    I have posted on this forum, cause you can read the source code
    of all my libraries and port them to C++ if you want.

    I have giving you all the source code of my following libraries:


    Parallel Quicksort 1.0
    Parallel implementation of Conjugate Gradient Linear System Solver 1.02
    Parallel implementation of Jacobi with relaxation Linear System Solver
    version 1.01
    Parallel Compression Library 2.17
    Parallel Hashlist (parallel hashtable) 1.44
    Parallel Sort Library 2.6
    Lockfree MPMC and SPMC fifo queues version 1.13
    Lockfree MPMC and SPMC priority FIFO queues version 1.1
    AWE version 1.23
    Threadpool 1.38 (stable version)
    Threadpool with priority 1.26 (stable version)
    Parallel Matrix demo


    You can download them from:

    http://pages.videotron.com/aminer/


    Thank you,
    Amine Moulay Ramdane,



    "aminer" <> wrote in message
    news:k0mhff$4n3$...
    > Hello,
    >
    > Parallel Quicksort 1.0 is here.
    >
    >
    > Description:
    >
    > Parallel Quicksort that uses my threadpool engine.
    >
    > Parallel Quicksort gave me 3x scaling when sorting strings on a quad
    > cores,
    > it scales better than the parallel quicksort in the parallelsort library..
    >
    > Please use Lazarus-1.1-38262-fpc-2.6.1 from
    > http://mirrors.iwi.me/lazarus/snapshots / cause it scales better on this
    > version.
    >
    >
    > Hello,
    >
    > It is easy to use parallel quicksort , you can sort strings , integers ,
    > reals, doubles etc
    > you can even sort them when they are inside objects.
    >
    > Here is an example that i gave you inside the zip file, i am sorting
    > strings
    > that are inside objects:
    >
    > :
    > ---
    >
    > program test;
    >
    > uses parallelquicksort,sysutils,timer;
    >
    > type
    >
    > TStudent = Class
    > public
    > Name: string;
    > end;
    > ?
    > var tab:Ttabpointer;
    > myobj:TParallelSort;
    > student:TStudent;
    > i:integer;
    >
    >
    > function comp(Item1, Item2: Pointer): integer;
    >
    > begin
    >
    > if TStudent(Item1).name < TStudent(Item2).name
    > then
    > begin
    > result:=-1;
    > exit;
    > end;
    >
    > if TStudent(Item1).name > TStudent(Item2).name
    > then
    > begin
    > result:=1;
    > exit;
    > end;
    >
    > if TStudent(Item1).name = TStudent(Item2).name
    > then
    > begin
    > result:=0;
    > exit;
    > end;
    > ?
    > end;
    >
    > begin
    >
    > myobj:=TParallelSort.create(4); // set to the number of cores...
    >
    > setlength(tab,100000);
    >
    > for i:=low(tab) to high(tab)
    > do
    > begin
    > student:=TStudent.create;
    > student.name:= inttostr(i);
    > tab[high(tab)-i]:= student;
    > end;
    > ?
    > HPT.Timestart;
    >
    > myobj.pqsort(tab,comp);
    >
    > writeln;
    > writeln('Time in microseconds: ',hpt.TimePeriod);
    > ?
    > writeln;
    >
    > writeln('Please press a key to continu...');
    >
    > readln;
    >
    > for i := LOW(tab) to HIGH(Tab)
    > do
    > begin
    > writeln(TStudent(tab).name,' ');
    > end;
    >
    > for i := 0 to HIGH(Tab) do freeandnil(TStudent(tab));
    > setlength(tab,0);
    > myobj.free;
    >
    > end.
    >
    > ---
    >
    >
    >
    > Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/
    >
    > or Lazarus 32 bits or 64 bits from:
    >
    > http://mirrors.iwi.me/lazarus/snapshots/
    >
    > Operating Systems: Win , Linux and Mac (x86).
    >
    >
    > You can download parallelquicksort from:
    >
    > http://pages.videotron.com/aminer/
    >
    >
    >
    > Thank you,
    > Amine Moulay Ramdane.
    >
    >
    >
    >
    aminer, Aug 18, 2012
    #2
    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. simo

    Parallel quicksort (MPI)

    simo, Mar 7, 2007, in forum: C Programming
    Replies:
    2
    Views:
    2,128
    user923005
    Mar 7, 2007
  2. Soren
    Replies:
    4
    Views:
    1,250
    c d saunter
    Feb 14, 2008
  3. Kevin McMurtrie

    Re: Parallel quicksort

    Kevin McMurtrie, May 16, 2010, in forum: Java
    Replies:
    0
    Views:
    692
    Kevin McMurtrie
    May 16, 2010
  4. Arne Vajhøj

    Re: Parallel quicksort

    Arne Vajhøj, May 16, 2010, in forum: Java
    Replies:
    9
    Views:
    1,370
    kebodi
    Nov 6, 2010
  5. aminer
    Replies:
    0
    Views:
    366
    aminer
    Aug 18, 2012
Loading...

Share This Page