Skip to content

Installation (arch linux)

Liesl edited this page Feb 25, 2014 · 1 revision

For the most part

pacman -S package

works for the dependencies.

MKL is harder. There is a AUR package for intel_studio, which contains mkl. You still need to get the license from intel. If you can get a free one do so. The license file however is not available by link or email, although those used to be options. To get mine I had to start the online download, enter the activation code, and then wait for the install to crash (since it doesn't understand arch), then find the .lic file and copy it into the correct location. Arch's Intel c++ page is good for this. When they say "be sure that the .lic file is in the $startdir" they mean put the .lic file into your unpacked package at the top level.

So in my case, intel-parallel-studio-xe.tar.gz unpacks into intel-compiler-base, which contains several other packages:

EULA.txt             
intel-compiler-base.conf  
intel-composer.install  
intel-idb.conf         
intel-ipp.conf  
intel-mkl.install  
intel-mkl-th.conf  
intel-tbb.conf     
intel_vtune-amplifier-xe.sh
intel_advisor-xe.sh  
intel_compilers.sh        
intel-fortran.conf      
intel_inspector-xe.sh  
intel-mkl.conf  
intel-mkl.sh       
intel-openmp.conf  
intel-tbb.install  
PKGBUILD

Before running makepkg, put your .lic file in here. You could put it into the install location at /opt/intel/licenses/ later, but it places it for you, and doesn't post as many warnings if you put it in now. Running makepkg will download and build the packages unless dependencies are missing.

After that you will need to run "pacman -U package" on each component that you want, (MKL) but at the very least you will need:

intel-compiler-base
intel-openmp
intel-fortran-compiler
intel-mkl

I installed everything just to be safe, but remember to install intel-compiler-base first, since everything else needs that. Also you will want to run the scripts in /opt/intel/mkl/bin: mklvars.sh, and/or intel64/mklvars_intel64.sh which will add some additional environment vars.

Remember to restart or logout and back in after installing.

Also be sure you update paths in Makefile.config.

Now the Cuda errors:

src/caffe/layers/pooling_layer.cu(163): error: kernel launches from templates are not allowed in system files
src/caffe/layers/pooling_layer.cu(168): error: kernel launches from templates are not allowed in system files
src/caffe/layers/pooling_layer.cu(289): error: kernel launches from templates are not allowed in system files
src/caffe/layers/pooling_layer.cu(295): error: kernel launches from templates are not allowed in system files
src/caffe/layers/pooling_layer.cu(301): error: kernel launches from templates are not allowed in system files

5 errors detected in the compilation of "/tmp/tmpxft_00000bde_00000000-4_pooling_layer.cpp4.ii".
Makefile:130: recipe for target 'src/caffe/layers/pooling_layer.cuo' failed
make: *** [src/caffe/layers/pooling_layer.cuo] Error 2

These happened before switching to gcc4.4. So my version of arch uses gcc 4.8, but Cuda works better (for now) with 4.6, or 4.4. When I tried this, 4.6 was out of date, so i went with 4.4. I used Yaourt (AUR package) to get gcc44 from AUR and install beside my existing gcc. Then I just changed the path in Makefile.config:

# DEFINE THE CXX PATH
#CXX=/usr/bin/g++
CXX=/usr/bin/g++-4.4 

Now everything will be built using 4.4 instead.

If you try compiling now, everything may work, or you may get this:

/usr/bin/g++-4.4 examples/train_net.o libcaffe.a -o examples/train_net.bin -L/usr/lib -L/usr/local/lib -L/opt/cuda/lib64 -L/opt/cuda/lib -L/opt/intel/mkl/lib -L/opt/intel/mkl/lib/intel64 -lcudart -lcublas -lcurand -lprotobuf -lopencv_core -lopencv_highgui -lglog -lmkl_rt -lmkl_intel_thread -lleveldb -lsnappy -lpthread -lboost_system -lopencv_imgproc -Wall
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_lp64_zzeros'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_lapack_xzpttrs'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_ccsr1ttlnf__smout_par'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_dcsr0ttluc__mmout_par'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_blas_zdotu'
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to ...

If this happens to you, you are missing links to some mkl files, and also may have them in the wrong order. To fix mine I needed to add mkl_core and iomp5 to my libraries, and the order that worked for me in the Makefile was this:

LIBRARIES := cudart cublas curand protobuf opencv_core opencv_highgui \
    glog mkl_core mkl_rt mkl_intel_thread leveldb snappy pthread \
    iomp5 boost_system opencv_imgproc

After this, compilation worked for me.

Possible issues:

  • Missing mkl licenses
  • Wrong link order
  • Wrong version of Cuda (I used 5.5)
  • Wrong version of gcc (4.4 worked, 4.8 didn't)
  • Wrong path in Makefile.config, or $PATH, or $LD_LIBRARY_PATH, although the latter two were not needed for mine.
Clone this wiki locally