This forum has been archived. All content is frozen. Please use KDE Discuss instead.

BiCGSTAB

Tags: None
(comma "," separated)
tuccio
Registered Member
Posts
4
Karma
0
OS

BiCGSTAB

Fri Nov 04, 2011 6:11 pm
hi,

i wanted to use eigen's BiCGSTAB solver, but i've some problems with it

i've this switch

Code: Select all
   switch (alg)
   {

   case LU:

      {

         SparseLU<SparseMatrix<double>, UmfPack> lu(A1squared);

         if (lu.succeeded())
         {

            solved = lu.solve(b1, &v);

         }

      }

      break;

   case BICGSTAB:

      {

         BiCGSTAB<SparseMatrix<double, RowMajor>> bicg;
         bicg.compute(A1squared);
         
         v = bicg.solve(b1);

         solved = (bicg.info() == Success);

      }

      break;

   default:

      break;

   }


but bicg fails at solving the system (while, on the same input, umfpack solves it).. is there any reason i don't know for which bicg can fail, when lu succeds? or maybe i'm doing it wrong?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: BiCGSTAB

Fri Nov 04, 2011 8:48 pm
In some cases, the bi-conjugate gradient stabilized algorithm can stagnate. This can sometime be overcame with good preconditioners and/or hybrid approaches.
tuccio
Registered Member
Posts
4
Karma
0
OS

Re: BiCGSTAB

Thu Nov 10, 2011 1:34 am
well, my error was that "RowMajor" you see which wasn't supposed to be there :D

but i've another problem now

running my program on windows, bicgstab is slightly slower than umfpack solving, and that is fine, but when i run the same program on linux the time spread between umfpack and bicgstab solving is much wider

for instance, a solving can take 3 secs on windows (compiling with visual c++) with umfpack, and 7 with bicgstab, while it takes 4 secs on linux (compiling with gcc/g++) with umfpack and 31 with bicgstab.. any ideas to explain this behaviour?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: BiCGSTAB

Thu Nov 10, 2011 7:05 am
make sure you compile with optimizations, i.e., -O2
tuccio
Registered Member
Posts
4
Karma
0
OS

Re: BiCGSTAB

Fri Nov 11, 2011 12:08 pm
ggael wrote:make sure you compile with optimizations, i.e., -O2
oh, thank you, now it runs much faster, significantly faster than the windows version, compiled with vc.. maybe there's a reference out there about the flags i should use to optimize eigen's code for vc? (i've tried /O2 and /Ot but i can't see any difference)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: BiCGSTAB

Fri Nov 11, 2011 6:18 pm
How much faster? In general VC is known to produce slightly slower code than recent GCC versions, especially with complex template code as Eigen.
Andre
Registered Member
Posts
90
Karma
1

Re: BiCGSTAB

Fri Nov 11, 2011 6:22 pm
You might have to add /arch:SSE2 if you're compiling for 32bit.


'And all those exclamation marks, you notice? Five? A sure sign of someone who wears his underpants on his head.' ~Terry Pratchett

'It's funny. All you have to do is say something nobody understands and they'll do practically anything you want them to.' ~J.D. Salinger
tuccio
Registered Member
Posts
4
Karma
0
OS

Re: BiCGSTAB  Topic is solved

Sat Nov 12, 2011 6:09 pm
oh, well.. probably it's just because i compile with a 64 bit gcc version and a 32 bit vc version

maybe i should give some details: i'm writing a solver for a problem that needs 3 linear systems to be computed, one is ~2n x ~2n, the others are ~n x ~n

compiling with gcc on ubuntu x64, when n = ~107k it takes ~81 seconds to run

compiling with vc (32 bit compiler) and running on windows 7 x64, when n = ~107k, it takes ~103 seconds to run

it seems to me a big difference.. i don't know how eigen works exactly, can this difference be explained by the 32/64 bit compiling?

ps: the /arch:SSE2 slightly worsens the performances (really slightly, it goes from 103 to 107 seconds to run on the same input)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]