Recent

Author Topic: Parallel Quicksort 1.0 is here  (Read 5415 times)

aminer

  • Hero Member
  • *****
  • Posts: 956
Parallel Quicksort 1.0 is here
« on: August 17, 2012, 11:30:16 pm »

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.

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

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel Quicksort 1.0 is here
« Reply #1 on: August 17, 2012, 11:57:07 pm »

Hello,

It is easy to use parallel quicksort , you can sort strings , integers  , reals, doubles etc
you can sort even sort then 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.
---


Thank you,
Amine Moulay Ramdane.


aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel Quicksort 1.0 is here
« Reply #2 on: August 18, 2012, 12:01:07 am »


I wrote:
>It is easy to use parallel quicksort , you can sort strings , >integers  , reals, doubles etc
>you can sort even sort then when they are inside objects.


Sorry for the typo, i mean you can even sort them when they are inside objects.



Thank you,
Amine Moulay Ramdane.







aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel Quicksort 1.0 is here
« Reply #3 on: August 18, 2012, 06:26:19 am »

Hello,

I have updated parallel quicksort to version 1.01

You can download it from:

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


Thank you,
Amine Moulay Ramdane



aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel Quicksort 1.0 is here
« Reply #4 on: August 18, 2012, 03:57:33 pm »


Hello,

I have updated parallelquicksort to version 1.02, what have changed ?

In the constructor i have set the number of item for each queue  to 2^12 to use less memory, before it was set to 2^15.

TP := TThreadPool.Create(nbrprocessors, 12, TMyThread);  nbrprocs workers threads and 2^15 items for each queue.


You can download parallelquicksort  from:

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


Thank you,
Amine Moulay Ramdane













aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Parallel Quicksort 1.0 is here
« Reply #5 on: August 21, 2012, 06:21:04 pm »

Hello,


I have updated parallelquicksort to version 1.03

You can download parallelquicksort  from:

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


Thank you,
Amine Moulay Ramdane

 

TinyPortal © 2005-2018