[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PETSc vs Matlab Performance



Having just finished writing my first modest PETSc-based application, I was amazed how much faster the code was than my Matlab prototype, even running in sequentially on a single processor. The code basically involves propagating a time series using Backward Euler, where the rate matrix K, is static. Granted I might be doing something horribly inefficient in my Matlab code, since I had code the Backward Euler, but given that the bulk of the time is spent in the matlab solver (either qmr or gmres), it seems that seems unlikely. Running with a single processor, the actual solver part of my PETSc code runs 15-25x faster than the equivalent part in my matlab code, and this is without using any optimization flags on the compiler and having compiled PETSc with debugger options on (the - log_summary output says that that would slow things down by a factor of 2-3x). I had always been told that for doing any sort of Linear Algebra sort of stuff, like inverting a matrix, Matlab's algorithms were as fast as anything you could hand code in C or Fortran (although when they say 'you', they might mean 'me' specifically and not the people who write PETSc).

Have there been any official benchmarks, pitting PETSc again Matlab? And for the CS novice, what is the underlying reason for the difference?

Thanks,
Josh


------------------------------------------------------------------------ ------------------------------
Joshua L. Adelman
Biophysics Graduate Group Lab: 510.643.2159
218 Wellman Hall Fax: 510.642.7428
University of California, Berkeley http://www.ocf.berkeley.edu/ ~jadelman
Berkeley, CA 94720 USA jadelman@xxxxxxxxxxxxxxxx
------------------------------------------------------------------------ ------------------------------