Matlab, Octave, FreeMat, and Scilab Comparative Evaluation of

1
Comparative Evaluation of Matlab, Octave, FreeMat, and Scilab Matthew Brewster ([email protected]) and Matthias K. Gobbert ([email protected]) Department of Mathematics and Statistics, UMBC, www.math.umbc.edu/ gobbert Matlab is the most popular commercial package for numer- ical computations in mathematics, statistics, the sciences, engineering, and other fields. Octave, FreeMat, and Scilab are free numerical computational packages that have many of the same features as Matlab. They are available to down- load on the Linux, Windows, and Mac OS X operating systems. We investigate whether these packages are viable alternatives to Matlab for uses in research and teaching. We compare the results on the cluster tara with 86 nodes, each with two quad- core Intel Nehalem processors (2.66 GHz, 8 MB cache per core) and 24 GB of memory. Problem Numerical solution Numerical error Classical test problem given by the numerical solution using finite differences of the Poisson equation with homogeneous Dirichlet boundary conditions given as -u = f in Ω, u =0 on Ω, Ω = (0, 1) × (0, 1) R 2 . Test problem solution: u(x, y ) = sin 2 (πx) sin 2 (πy ). Finite difference error converges as u - u h L (Ω) Ch 2 as mesh width h 0, thus the ratio of errors on consecutively refined meshes approaches 4. N DOF u - u h Ratio 32 1,024 3.0128e-3 N/A 64 4,096 7.7811e-4 3.8719 128 16,384 1.9765e-4 3.9368 256 65,536 4.9797e-5 3.9690 512 262,144 1.2494e-5 3.9856 1,024 1,048,576 3.1266e-6 3.9961 2,048 4,194,304 7.8019e-7 4.0075 4,096 16,777,216 1.9353e-7 4.0313 8,192 67,108,864 4.6797e-8 4.1355 * Mesh resolution N × N , mesh width h =1/(N + 1). * DOF means the degrees of freedom and represents the size of the matrices. Test Problem N DOF Matlab Octave FreeMat Scilab 32 1,024 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:01 64 4,096 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:01 128 16,384 < 00:00:01 < 00:00:01 < 00:00:01 00:00:11 256 65,536 < 00:00:01 < 00:00:01 00:00:04 00:03:19 512 262,144 00:00:01 00:00:02 00:00:28 00:39:04 1,024 1,048,576 00:00:31 00:00:16 00:03:15 09:09:32 2,048 4,194,304 00:00:27 00:01:57 00:14:29 O.M. 4,096 16,777,216 00:02:07 00:15:37 O.M. O.M. 8,192 67,108,864 O.M. O.M. O.M. O.M. * O.M. means out of memory. * Scilab required the use of a translator as well as the stacksize(”max”) function to use all available memory. Gaussian Elimination N DOF #iter Matlab Octave FreeMat Scilab 32 1,024 48 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:01 64 4,096 96 < 00:00:01 < 00:00:01 00:00:03 < 00:00:01 128 16,384 192 < 00:00:01 < 00:00:01 00:00:23 < 00:00:01 256 65,536 387 00:00:02 00:00:03 00:03:07 00:00:04 512 262,144 783 00:00:40 00:00:27 00:15:21 00:00:36 1,024 1,048,576 1,581 00:05:47 00:04:23 03:24:25 00:06:57 2,048 4,194,304 3,192 00:50:26 00:40:07 03:52:24 00:48:12 4,096 16,777,216 6,452 07:46:24 05:52:11 T.L.E. 06:03:58 8,192 67,108,864 13,033 69:21:23 40:44:32 T.L.E. O.M. * O.M. means out of memory. * T.L.E means time limit exceeded. * Scilab required the use of a translator as well as the stacksize("max") function to use all available memory. * FreeMat did not have a conjugate gradient function as well as other functions so we had to write our own. Conjugate Gradient Method The first author acknowledges financial support from the Department of Mathematics and Statistics at UMBC. The hardware used in the computational studies is part of the UMBC High Performance Computing Facility (www.umbc.edu/hpcf). Acknowledgments For Gaussian elimination, Matlab is faster than Octave, which is faster than FreeMat; Scilab is slowest and could not solve the same mesh resolution as the other packages. For the conjugate gradient method, Matlab, Octave, and Scilab are comparably fast, and FreeMat is slower. We conclude from the test results that among free numerical computational packages Octave is the most compatible with Matlab due to its numerical abilities as well as its similarity in syntax. Another reason to recommend Octave is that free parallel computing extenstions are available and are known to work with the package. Reference: For complete details of these studies, see the tech. report HPCF–2011–10 at www.umbc.edu/hpcf > Publications. Conclusions

Transcript of Matlab, Octave, FreeMat, and Scilab Comparative Evaluation of

Page 1: Matlab, Octave, FreeMat, and Scilab Comparative Evaluation of

Comparative Evaluation ofMatlab, Octave, FreeMat, and ScilabMatthew Brewster ([email protected]) and Matthias K. Gobbert ([email protected])

Department of Mathematics and Statistics, UMBC, www.math.umbc.edu/∼gobbert

Matlab is the most popular commercial package for numer-ical computations in mathematics, statistics, the sciences,engineering, and other fields. Octave, FreeMat, and Scilabare free numerical computational packages that have manyof the same features as Matlab. They are available to down-load on the Linux, Windows, and Mac OS X operating systems.We investigate whether these packages are viable alternativesto Matlab for uses in research and teaching. We compare theresults on the cluster tara with 86 nodes, each with two quad-core Intel Nehalem processors (2.66 GHz, 8 MB cache per core)and 24 GB of memory.

Problem

Numerical solution Numerical error

Classical test problem given by the numerical solution using finite differences of thePoisson equation with homogeneous Dirichlet boundary conditions given as

−4u = f in Ω,u = 0 on ∂Ω,

Ω = (0, 1)× (0, 1) ⊂ R2. Test problem solution: u(x, y) = sin2(πx) sin2(πy).Finite difference error converges as ‖u− uh‖L∞(Ω) ≤ C h2 as mesh width h → 0,

thus the ratio of errors on consecutively refined meshes approaches 4.

N DOF ‖u− uh‖ Ratio32 1,024 3.0128e-3 N/A64 4,096 7.7811e-4 3.8719

128 16,384 1.9765e-4 3.9368256 65,536 4.9797e-5 3.9690512 262,144 1.2494e-5 3.9856

1,024 1,048,576 3.1266e-6 3.99612,048 4,194,304 7.8019e-7 4.00754,096 16,777,216 1.9353e-7 4.03138,192 67,108,864 4.6797e-8 4.1355

* Mesh resolution N ×N , mesh width h = 1/(N + 1).

* DOF means the degrees of freedom and represents the size of the matrices.

Test Problem

N DOF Matlab Octave FreeMat Scilab32 1,024 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:0164 4,096 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:01

128 16,384 < 00:00:01 < 00:00:01 < 00:00:01 00:00:11256 65,536 < 00:00:01 < 00:00:01 00:00:04 00:03:19512 262,144 00:00:01 00:00:02 00:00:28 00:39:04

1,024 1,048,576 00:00:31 00:00:16 00:03:15 09:09:322,048 4,194,304 00:00:27 00:01:57 00:14:29 O.M.4,096 16,777,216 00:02:07 00:15:37 O.M. O.M.8,192 67,108,864 O.M. O.M. O.M. O.M.

* O.M. means out of memory.

* Scilab required the use of a translator as well as the stacksize(”max”) function to

use all available memory.

Gaussian Elimination

N DOF #iter Matlab Octave FreeMat Scilab32 1,024 48 < 00:00:01 < 00:00:01 < 00:00:01 < 00:00:0164 4,096 96 < 00:00:01 < 00:00:01 00:00:03 < 00:00:01

128 16,384 192 < 00:00:01 < 00:00:01 00:00:23 < 00:00:01256 65,536 387 00:00:02 00:00:03 00:03:07 00:00:04512 262,144 783 00:00:40 00:00:27 00:15:21 00:00:36

1,024 1,048,576 1,581 00:05:47 00:04:23 03:24:25 00:06:572,048 4,194,304 3,192 00:50:26 00:40:07 03:52:24 00:48:124,096 16,777,216 6,452 07:46:24 05:52:11 T.L.E. 06:03:588,192 67,108,864 13,033 69:21:23 40:44:32 T.L.E. O.M.

* O.M. means out of memory.

* T.L.E means time limit exceeded.

* Scilab required the use of a translator as well as the stacksize("max") function

to use all available memory.

* FreeMat did not have a conjugate gradient function as well as other functions so

we had to write our own.

Conjugate Gradient Method

The first author acknowledges financial support from the Department of Mathematics

and Statistics at UMBC. The hardware used in the computational studies is part of

the UMBC High Performance Computing Facility (www.umbc.edu/hpcf).

Acknowledgments

• For Gaussian elimination, Matlab is faster than Octave, whichis faster than FreeMat; Scilab is slowest and could not solve thesame mesh resolution as the other packages.

• For the conjugate gradient method, Matlab, Octave, and Scilabare comparably fast, and FreeMat is slower.

• We conclude from the test results that among free numericalcomputational packages Octave is the most compatible withMatlab due to its numerical abilities as well as its similarityin syntax. Another reason to recommend Octave is that freeparallel computing extenstions are available and are knownto work with the package.

Reference: For complete details of these studies, see the tech. report

HPCF–2011–10 at www.umbc.edu/hpcf > Publications.

Conclusions