From bug-request at octave dot org Wed Jan 11 21:03:03 2006 Subject: Compiling octave with Intel C++/Fortran compilers on Linux From: "Tetsuji \"Maverick\" Rai" To: bug at octave dot org Date: Thu, 12 Jan 2006 12:01:26 +0900 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've successfully compiled octave with Intel C++/Fortran compiler on Gentoo Linux on P4 to make it faster and probably more accurate (because it's more accurate than gcc-3.4.4 with proper options.) But I needed a tweak, so I write diff here. It's in src/oct-stream.cc, and the diff for 2.1.72 is *** ../../octave-2.1.72/src/oct-stream.cc Sat Nov 12 04:48:27 2005 - ---- ./oct-stream.cc Thu Jan 12 05:47:20 2006 *************** *** 1143,1148 **** - ---- 1143,1149 ---- octave_scan (std::istream&, const scanf_format_elt&, float*); #endif + #if !defined(__INTEL_COMPILER) // TMR template <> std::istream& octave_scan (std::istream& is, const scanf_format_elt& fmt, double* valptr) *************** *** 1317,1323 **** return is; } ! template std::istream& octave_scan (std::istream&, const scanf_format_elt&, double*); - ---- 1318,1324 ---- return is; } ! #endif //TMR template std::istream& octave_scan (std::istream&, const scanf_format_elt&, double*); In order to compile octave with Intel C++ 9.0/Fortran 9.0, at first install these compilers (as a matter of course!) and set these environment variables: export CC=icc export CFLAGS='-O3 -mp -xP -ip -I/usr/local/include' export CXX=icpc export CXXFLAGS='-O3 -mp -xP -ip -I/usr/local/include' export F77=ifort export FFLAGS='-O3 -mp -xP -ip -I/usr/local/include' export LDFLAGS='-L/usr/local/lib -lsvml' Last "-L/usr/local/lib" specifies the location of fftw library. Then ./configure and make as usual. In these options, -mp option keeps ieee compliant accuracy (by default, fortran compiler isn't given -mieee-fp option) -xP specifies sse3 (so one has to change it to -xW for sse2, -xK for sse), and -ip for single file interprocedural optimization. I also tried -ipo[n] flag, but I found octave was too large to utilize that option; it took too long to link octave. -ipo[large number] may work (I'm trying,) but in that case, one needs to set "export AR=xiar" also. fftw can also be compiled with these options to make it faster. regards, - -- Tetsuji 'Maverick' Rai main page http://maverick6664.bravehost.com/ PGP pubkey http://mav.atspace.com/maverick31337_at_gmail_dot_com.txt PGP Key ID: 0x971E57CA Key fingerprint: F790 28AF E95B 48C9 19AB 71FD 50B5 3572 971E 57CA Aviation Jokes: http://www.geocities.com/tetsuji_rai/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDxcaEULU1cpceV8oRAobwAJ44LvGYNxd6SFX064ZnmjahaKf/+gCggqP8 tmj5PEwQiJPZ7sjAuUIXqUc= =bD6e -----END PGP SIGNATURE----- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------