DISLAIMER: The below instructions are for 64 bit machines. For 32 bit machines follow other instructions: http://bickson.blogspot.com/2011/06/graphlab-pmf-on-32-bit-linux.html
FOR LAZY READERS:
Just use Amazon EC2 public image ami-c21eedab (Ubuntu)
INSTALLATION VIA YUM/APT-GET
Try to install itpp using the following command:
sudo yum install libitpp-devOr
sudo apt-get install libitpp-devTIP: You may also want to install libitpp7-dbg using the yum/apt-get command.
It is not mandatory, but it helps debugging when you link against libitpp_debug.so
(instead of libitpp.so).
If the above worked then we are done. If not, you will need to follow
instructions below. Thanks to Udi Weinsberg for this tip.
FOR ADVANCED USERS:
0) Start with an Ubuntu image like ami-641eed0d, or an Amazon AMI image like:
1) Install required packages. For Ubuntu:
sudo apt-get install --yes --force-yes automake autoconf libtool* gfortranFor Amazon Linux:
sudo yum install -y automake autoconf libtool* gcc-gfortran
2) Install lapack.
Here again their are two options:
The easy way is to simply (On Ububtu)
sudo apt-get install --yes --force-yes liblapack-devOn Amazon Linux:
sudo yum install -y lapack-devel blas-devel
Thanks Akshay Bhat from Cornell for this tip!
If the liblapack setup was successful, go to step 3.
If the above command DOES NOT work for you (depends on your OS and setup) you will need to install lapack manually. The procedure is explained in steps a-c below.
a) Download and prepare the code
wget http://www.netlib.org/lapack/lapack.tgz tar xvzf lapack.tgz cd lapack-3.3.0 //if version number changes, change here to the right directory mv make.inc.example make.inc
b) edit make.inc and add -m64 -fPIC flag to fortran compiler options:
# FORTRAN, OPTS, NOOPT, LOADER
c) compile
make blaslib makeIf everthing went OK, test will be run for a couple of minutes
and the files blas_LINUX.a and lapack_LINUX.a will be created at the main directory
3) setup LDFLAGS
export LDFLAGS="-L/usr/lib -lgfortran"
4) Download and install itpp from
wget http://sourceforge.net/projects/itpp/files/itpp/4.2.0/itpp-4.2.tar.gz tar xvzf itpp-4.2.tar.gz cd itpp-4.2 ./autogen.shIf you installed Lapack from yum/apt-get, you should use the following command:
./configure --without-fft --with-blas=/usr/lib64/libblas.so --with-lapack=/usr/lib64/liblapack.so --enable-debug CFLAGS=-fPIC CXXFLAGS=-fPIC CPPFLAGS=-fPICWhere /usr/lib64/ is the place where lapack was installed.
If you installed lapack from source, use the following command
./configure --without-fft --with-blas=/home/ubuntu/lapack-3.3.0/blas_LINUX.a --with-lapack=/home/ubuntu/lapack-3.3.0/lapack_LINUX.a CFLAGS=-fPIC CXXFLAGS=-fPIC CPPFLAGS=-fPIC
make sudo make installNote: If you installed lapack from yum/apt-get, don't forget to add the -lblas -llapack linker flag when you compile against lapack/blas.
Verifying installation
To verify that installation went Ok, run the following commands:
itpp-config --cflags itpp-config --libs1) The command itpp-config should be available from shell.
2) The right installation path should appear as output.
Known issues you may encounter:
Problem:
*** Warning: Linking the shared library libitpp.la against the^M *** static library /usr/lib64/libblas.a is not portable!^M libtool: link: g++ -shared -nostdlib /usr/lib/gcc/x86_64-amazon-linux/4.4.4/../../../../lib64/crti.o /usr/lib/gcc/x86_64-amazon-linux/4.4.4/crtbeginS.o -Wl,--whole-archive ../itpp/base/.libs/libbase.a ../itpp/stat/.libs/libstat.a ../itpp/comm/.libs/libcomm.a ../itpp/fixed/.libs/libfixed.a ../itpp/optim/.libs/liboptim.a ../itpp/protocol/.libs/libprotocol.a ../itpp/signal/.libs/libsignal.a ../itpp/srccode/.libs/libsrccode.a -Wl,--no-whole-archive -L/usr/lib64/ /usr/lib64/liblapack.a /usr/lib64/libblas.a -lgfortranbegin -lgfortran -L/usr/lib/gcc/x86_64-amazon-linux/4.4.4 -L/usr/lib/gcc/x86_64-amazon-linux/4.4.4/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-amazon-linux/4.4.4/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-amazon-linux/4.4.4/crtendS.o /usr/lib/gcc/x86_64-amazon-linux/4.4.4/../../../../lib64/crtn.o -Wl,-soname -Wl,libitpp.so.7 -o .libs/libitpp.so.7.0.0^M /usr/bin/ld: /usr/lib64/liblapack.a(dgees.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC^M /usr/lib64/liblapack.a: could not read symbols: Bad value^M collect2: ld returned 1 exit status^M make[2]: *** [libitpp.la] Error 1^MSolution: it seems that lapack was statically compiled without the -fPIC option and thus itpp refuses to link against it. Follow step 2a to install lapack manaually with the -fPIC option.
Problem:
make[1]: *** Waiting for unfinished jobs.... [ 83%] Building CXX object src/graphlab/CMakeFiles/Solution: itpp was compiled using dynamic libraries, but your application did not include the -lblas and -llapack link flags.graphlab_pic.dir/distributed2/ distributed_scheduler_list.o /usr/local/lib/libitpp.so: undefined reference to `zgesv_' /usr/local/lib/libitpp.so: undefined reference to `dorgqr_' /usr/local/lib/libitpp.so: undefined reference to `dswap_' /usr/local/lib/libitpp.so: undefined reference to `dgeqp3_' /usr/local/lib/libitpp.so: undefined reference to `dpotrf_' /usr/local/lib/libitpp.so: undefined reference to `dgemm_' /usr/local/lib/libitpp.so: undefined reference to `zungqr_' /usr/local/lib/libitpp.so: undefined reference to `zscal_' /usr/local/lib/libitpp.so: undefined reference to `dscal_' /usr/local/lib/libitpp.so: undefined reference to `dgesv_' /usr/local/lib/libitpp.so: undefined reference to `dgetri_' /usr/local/lib/libitpp.so: undefined reference to `zgemm_' /usr/local/lib/libitpp.so: undefined reference to `zposv_' /usr/local/lib/libitpp.so: undefined reference to `zgetri_' /usr/local/lib/libitpp.so: undefined reference to `dgeev_' /usr/local/lib/libitpp.so: undefined reference to `zgemv_' /usr/local/lib/libitpp.so: undefined reference to `zgeqrf_' /usr/local/lib/libitpp.so: undefined reference to `zgerc_' /usr/local/lib/libitpp.so: undefined reference to `zswap_' /usr/local/lib/libitpp.so: undefined reference to `zgeev_' /usr/local/lib/libitpp.so: undefined reference to `daxpy_' /usr/local/lib/libitpp.so: undefined reference to `dgetrf_' /usr/local/lib/libitpp.so: undefined reference to `zgels_' /usr/local/lib/libitpp.so: undefined reference to `zgetrf_' /usr/local/lib/libitpp.so: undefined reference to `dgees_' /usr/local/lib/libitpp.so: undefined reference to `dcopy_' /usr/local/lib/libitpp.so: undefined reference to `dger_' /usr/local/lib/libitpp.so: undefined reference to `dgels_' /usr/local/lib/libitpp.so: undefined reference to `dgeqrf_' /usr/local/lib/libitpp.so: undefined reference to `zpotrf_' /usr/local/lib/libitpp.so: undefined reference to `zgees_' /usr/local/lib/libitpp.so: undefined reference to `dgesvd_' /usr/local/lib/libitpp.so: undefined reference to `zgeru_' /usr/local/lib/libitpp.so: undefined reference to `dsyev_' /usr/local/lib/libitpp.so: undefined reference to `zaxpy_' /usr/local/lib/libitpp.so: undefined reference to `ddot_' /usr/local/lib/libitpp.so: undefined reference to `zgesvd_' /usr/local/lib/libitpp.so: undefined reference to `zgeqp3_' /usr/local/lib/libitpp.so: undefined reference to `zcopy_' /usr/local/lib/libitpp.so: undefined reference to `dgemv_' /usr/local/lib/libitpp.so: undefined reference to `dposv_' /usr/local/lib/libitpp.so: undefined reference to `zheev_' collect2: ld returned 1 exit status make[2]: *** [tests/anytests] Error 1 make[1]: *** [tests/CMakeFiles/anytests.dir/all] Error 2
Problem:
*** Error: You must have "autoconf" installed to compile IT++ SVN sources *** Error: You must have "automake" installed to compile IT++ SVN sources *** Error: You must have "libtoolize" installed to compile IT++ SVN sourcesSolution:
Need to install the packages autoconf, automake and libtoolize. See yum/apt-get documentation.
Problem:
/usr/bin/ld: /home/bickson/lapack-3.3.1/lapack_LINUX.a(dgees.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /home/bickson/lapack-3.3.1/lapack_LINUX.a: could not read symbols: Bad value collect2: ld returned 1 exit statusSolution:
It seem you forgot to follow section 2b.
TIP: It is useful to enable also itpp_debug library which is very useful when debugging your code. This is done by adding the flag --enable-debug to the configure script.
Problem:
*** Error in ../../../itpp/base/algebra/ls_solve.cpp on line 271: LAPACK library is needed to use ls_solve() functionSolution:
It seems that itpp is not installed properly -it did not link to lapack.