Chinaunix首页 | 论坛 | 博客
  • 博客访问: 472908
  • 博文数量: 115
  • 博客积分: 3777
  • 博客等级: 中校
  • 技术积分: 1070
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-07 09:20
文章分类

全部博文(115)

文章存档

2015年(1)

2013年(3)

2012年(26)

2011年(30)

2010年(34)

2009年(21)

我的朋友

分类: LINUX

2010-11-29 09:11:09



UO Quantum Control Cluster: Configuring and Building Octave



Introduction

is a very nice piece of software, but unfortunately it can be a real pain to compile from source, especially if you want to enable a few features that you can't otherwise get with prebuilt RPMs and such. This is what worked for me to build octave with / to speed up linear algebra, to speed up Fourier transforms, and using the Intel compilers (Fortran, C, C++), which generally outperform the corresponding GNU compilers.

This is what worked under CentOS 5.2, though the approaches here should work fairly generally. Getting the right compiler flags in each case took some tinkering, which is why I'm posting these notes here. You can also see how Octave is configured (and thus what is available) on the . Many more capabilities could be built in, but these were the ones I thought were most useful.

Is it worth all this effort over plain old Octave? Well, a really dumb benchmark is to run the following in Octave:

A=rand(5000,5000);
tic,b=A*A;toc

On the head node of the QC cluster , I got the following results:

  • Compiled with gcc, no ATLAS: 319 seconds
  • Compiled with ifort/icc/icpc, no ATLAS: 302 seconds
  • Compiled with ifort/icc/icpc, with ATLAS: 28.4 seconds

So the answer is, clearly yes! ATLAS especially makes the big difference.


Install FFTW:

In /usr/local/src:

wget 
tar xvzf fftw-3.2.tar.gz
cd fftw-3.2
./configure --with-pic
make
make install

Compile LAPACK:
cd /usr/local/src
wget
tar xvzf lapack.tgz
cd lapack-3.2
cp make.inc.example make.inc
vi make.inc

Now change the compiler to ifort, in particular change the following lines in make.inc to read:

FORTRAN  = ifort -warn declarations -fpic
OPTS = -O3
DRVOPTS = $(OPTS)
NOOPT =
LOADER = ifort
LOADOPTS =

Now continue with building...

cd BLAS/SRC
make
cd ../..
make

Compile ATLAS:

The loop below assumes you're doing this all in bash.

cd /usr/local/src
wget
tar xvjf atlas3.8.2.tar.bz2
cd ATLAS
mkdir intel-build-dir
cd !$
/usr/local/src/ATLAS/configure --with-netlib-lapack=/usr/local/src/lapack-3.2/lapack_LINUX-INTEL.a -C ic icc -F ic '-O3 -fpic' -C if ifort -F if '-O3 -fpic' -Fa alg -fpic
make
make check
cd lib
make shared
make ptshared
for i in /usr/local/src/ATLAS/intel-build-dir/lib/*.so; do echo $i; ln -sf $i /usr/local/lib/.; done

Now check /etc/ld.so.conf to make sure /usr/local/bin is in there somewhere. If not, then you can do the following (run ldconfig either way).

echo /usr/local/lib >> /etc/ld.so.conf
ldconfig

Compile Octave:

Not all of Octave's tests are successful, but close enough (it was about the same with plain Octave and gcc).

cd /usr/local/src
wget ftp://ftp.octave.org/pub/octave/octave-3.0.3.tar.bz2
.bz2
tar xvjf octave-3.0.3.tar.bz2
cd octave-3.0.3
export CC=icc
export CPP='icc -E'
export CXX=icpc
export CXXPP='icpc -E'
export F77=ifort
export FFLAGS='-fpic -O3'
export CFLAGS='-fpic -I/usr/local/src/ATLAS/intel-build-dir/include -L/usr/local/src/ATLAS/intel-build-dir/lib'
export CXXFLAGS='-fpic -I/usr/local/src/ATLAS/intel-build-dir/include -L/usr/local/src/ATLAS/intel-build-dir/lib'

./configure --enable-shared --enable-dl --disable-static --with-fftw --with-fastblas=/usr/local/src/ATLAS/intel-build-dir/lib/libatlas.so --with-lapack=/usr/local/src/ATLAS/intel-build-dir/lib/liblapack.so
make
make check
make install

Install Octave-Forge:

First, install a few prerequisites from RPMs:

http://stokkeland.name/mirror/centos/5.1/updates/x86_64/RPMS/ghostscript-devel-8.15.2-9.3.el5.x86_64.rpm
http://ftp.riken.jp/Linux/centos/5.2/os/x86_64/CentOS/lcms-devel-1.15-1.2.2.x86_64.rpm
http://ftp.riken.jp/Linux/centos/5.2/os/x86_64/CentOS/libwmf-devel-0.2.8.4-10.1.x86_64.rpm



http://ftp.riken.jp/Linux/centos/5.2/os/x86_64/CentOS/ImageMagick-c++-devel-6.2.8.0-4.el5_1.1.x86_64.rpm
http://ftp.riken.jp/Linux/centos/5.2/os/x86_64/CentOS/ImageMagick-devel-6.2.8.0-4.el5_1.1.x86_64.rpm

Now the GNU Scientific Library (clear the environment variables set above, this failed when I compiled it with Intel compilers; you want the GNU compilers).

cd /usr/local/src
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.12.tar.gz
tar xvzf gsl-1.12.tar.gz
cd gsl-1.12
./configure
make
make check
make install

Now GiNaC, for symbolic capabilities (not all tests passed when checking GiNaC)...

cd /usr/local/src
wget
tar xvjf cln-1.2.2.tar.bz2
cd cln-1.2.2
./configure
make
make check
make install
cd /usr/local/src
wget
tar xvjf ginac-1.4.4.tar.bz2
cd ginac-1.4.4
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure
make
make check
make install

Finally, get Octave-Forge...

wget 
tar xvzf octave-forge-bundle-20080831.tar.gz
cd octave-forge-bundle-20080831/main
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Now start up Octave (type 'octave'), and install some packages in the main section. These installed without complaining, which doesn't guarantee they're fully functional.

pkg install audio-1.1.2.tar.gz
pkg install benchmark-1.0.0.tar.gz
pkg install combinatorics-1.0.7.tar.gz
pkg install miscellaneous-1.0.7.tar.gz
pkg install optim-1.0.4.tar.gz
pkg install data-smoothing-1.1.1.tar.gz
pkg install signal-1.0.8.tar.gz
pkg install communications-1.0.8.tar.gz
pkg install ga-0.9.4.tar.gz
pkg install general-1.0.7.tar.gz
pkg install gsl-1.0.7.tar.gz
pkg install ident-1.0.6.tar.gz
pkg install image-1.0.8.tar.gz
pkg install io-1.0.7.tar.gz
pkg install linear-algebra-1.0.6.tar.gz
pkg install missing-functions-1.0.1.tar.gz
pkg install odebvp-1.0.5.tar.gz
pkg install odepkg-0.6.4.tar.gz
pkg install optim-1.0.4.tar.gz
pkg install optiminterp-0.3.1.tar.gz
pkg install parallel-1.0.7.tar.gz
pkg install physicalconstants-0.1.6.tar.gz
pkg install plot-1.0.6.tar.gz
pkg install signal-1.0.8.tar.gz
pkg install sockets-1.0.5.tar.gz
pkg install specfun-1.0.7.tar.gz
pkg install special-matrix-1.0.6.tar.gz
pkg install splines-1.0.6.tar.gz
pkg install statistics-1.0.7.tar.gz
pkg install strings-1.0.6.tar.gz
pkg install struct-1.0.6.tar.gz
pkg install time-1.0.8.tar.gz
pkg install zenity-0.5.6.tar.gz
pkg install symbolic-1.0.7.tar.gz

阅读(856) | 评论(0) | 转发(0) |
0

上一篇:[zz] 数学工具

下一篇:[zz] debian 下的dos2unix

给主人留下些什么吧!~~