Recent

Author Topic: Parallel Gauss-Seidel with relaxation iterative algorithm library version 1.1  (Read 4850 times)

aminer

  • Hero Member
  • *****
  • Posts: 956

Hello,

I have reworked my old Parallel Gauss-Seidel with relaxation iterative
program gsp.pas into a Parallel Gauss-Seidel with relaxation iterative
algorithm library version 1.1


Description

The Parallel iterative with relaxation method that i programmed here is designed
to be used to solve large sparse systems of linear equations where the direct methods
can exceed available machine memory and/or be extremely time-consuming. for example
the direct method of the Gauss algorithm takes O(n^2) in the back substitution process
and is dominated by the O(n^3) forward elimination process, that means, if for example
an operation takes 10^-9 second and we have 1000 equations , the elimination process
in the Gauss algorithm will takes 0.7 second, but if we have 10000 equations in the system ,
the elimination process in the Gauss algorithm will take 11 minutes !. This is why i have
develloped for you the Parallel Gauss-Seidel with relaxation iterative algorithm in Object Pascal,
that is very fast.

And please take a look at my article on my Parallel Gauss-Seidel with relaxation algorithm: GSRP.

The benchmarks are here: http://pages.videotron.com/aminer/ParallelGaussSeidel/gsrp.htm


And here is how to use the library, as you have noticed you have to initialize
your vector x first , and set your lambda inside the call to Solve(), i have set lambda to 0.01 ,
and set the number of cores  in the constructor, and pass you matrix and vector b to the Solve() method,
and that's all:


Here is the example:

---------------------

program test;


uses parallelgaussseidel,timer;

var gsp:TParallelGaussSeidel;
    i,j,size:integer;
    matrows: arrarrext;
  vecb,vecx: arrext;

begin


gsp:=TParallelGaussSeidel.create(4); // number of cores to use


size:=10000; // set it as you wish...
SetLength(matrows, size);
SetLength(vecb, size);
SetLength(vecx, size);
for I := Low(matrows) to High(matrows) do
  begin
   setlength(matrows,High(matrows)+1);
   end;

for I := Low(matrows) to High(matrows)
 do
  begin
   vecb:=100000000;
   vecx:=22222222;
   for J := Low(matrows) to High(matrows) do
   matrows[J] := 77770000777;
 end;

if gsp.testconvergence(matrows)
 then writeln('The system converge...')
      else writeln('The system may or may not converge...');

HPT.Timestart;

if gsp.Solve(matrows,vecb,vecx,0.01)

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

  writeln('The system converge...');
  writeln('The system solved...');
  writeln(vecx[0],' ',vecx[1],' ',vecx[2]); // write here you vecx...
 end

else
 begin
  writeln('The system doesn''t converge...');
 end;
 
SetLength(matrows, 0);
SetLength(vecb, 0);
SetLength(vecx, 0);

gsp.free;

end.


------



Please look at my parallel program test.pas inside the zip file , compile and execute it ... -

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

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

Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal

-Sd for delphi mode....

Required Delphi switches: -DMSWINDOWS -$H+ -DDelphi



Thank you,
Amine Moulay Ramdane.


aminer

  • Hero Member
  • *****
  • Posts: 956

Hello,


You can download Parallel Gauss-Seidel with relaxation iterative algorithm library
version 1.1 from:

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



Thank you.

Amine Moulay Ramdane.


aminer

  • Hero Member
  • *****
  • Posts: 956

Hello,

Just another thing, to not wait a long time if the system doesn't converge, please
set max_tries inside ParallelGaussSeidel to somehting like 40 or 20 , i have set
it to 100000.

You will find the variable max_tries  inside the Solve() method...



Thank you.

Amine Moulay Ramdane



aminer

  • Hero Member
  • *****
  • Posts: 956


Hello,

Or just let max_tries to 100000 , and if the Solve() doesn't
return for a long period, that means that your system doesn't
converge, so that means it will not give a solution, so just click
after that on Cltrl-C and that's all.



Thank you.

Amine Moulay Ramdane.



ideabrush

  • New Member
  • *
  • Posts: 24
Went to the page http://pages.videotron.com/aminer but couldn't find the download link. Could someone please point me to the right URL? Thanks!

 

TinyPortal © 2005-2018