This is the experiment code for the paper: 
"Fast Matrix-vector Multiplications for Large-scale Logistic Regression on Shared-memory Systems"

This code will generate the experimental result figures in the paper.
However, the result may be slightly different due to the CPU frequency
and the work load of your computer.

This code has been tested under a 64-bit Linux environment.

To run this experiment code, there are some requirement:

System Requirement
==================
This experiment should be running under 64-bit Linux environments
The following command are required:
- UNIX utilities (cp, mkdir)
- gcc 4.4.3 or newer version with openMP support
- Python 2.6 or Python 2.7
- make
- unzip

Library Requirement & Setting
=============================
Some methods compared in the paper require the following libraries:

- Intel Math Kernel Library (MKL): 
This is an optimizing BLAS implementation. 
The implementation of our method can work with this library.
You can find information about this library at

http://software.intel.com/en-us/intel-mkl

Note that you must use this library on a machine with Intel processors.
If you want to use this library,
you have to assign the absolute path of root directory of MKL
to MKL_ROOT in the Makefile.
Besides, 
you need to add the following paths to the environment variable LD_LIBRARY_PATH,

MKL_ROOT/mkl/lib/intel64
MKL_ROOT/compiler/lib/intel64

where MKL_ROOT is the absolute path of the root directory of MKL

- librsb:
This is an library for fast sparse matrix-vector multiplication by Michele Martone.
Details could be found at:
http://librsb.sourceforge.net/

Download link for librsb is at:
http://sourceforge.net/projects/librsb/

Building instruction may differ, please look for more details in the page.
The configure we used is:
./configure --enable-fortran-module-install --enable-matrix-types="double, double complex" \
LD=xild CC=icc FC=gfortran CFLAGS="-O3 -fPIC -xAVX" FCFLAGS="-O3 -fPIC -xAVX" --prefix=$HOME/local


Experiment Data
===============
Experiment Data used in this paper are available at
http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/


Run the Experiment
==================
1. To run the experiment code, go into the directories (liblr, liblr-mkl, liblr-omp, liblr-rsb, liblr-rsbXT) and make.
2. Edit ./script/runexp.py
	Enter what type of liblr you want to test in line 4.
	Then specify how many cores should be used in line 6.
	Dataset that should be tested would be in line 9, and the regularization parameter C is indicated in line 10. 
	In line 12~16, put where you want to put the model and log file, also the directory where you put your dataset in. 
	(For default setting, you should create directory 'exp_code/log' and 'exp_code/model')

3. After running the experiment, you could use ./script/draw-single.py to plot out the result.
	The usage is :
	python draw-single.py [testdata 1] [testdata 2] ...

Directories
===========
liblr         - The original LIBLINEAR
liblr-hvato   - LIBLINEAR that implements parallelization by OpenMP, which X^Tu uses atomic operation.
liblr-mkl     - LIBLINEAR that implements parallelization by Intel MKL
liblr-omp     - LIBLINEAR that implements parallelization by OpenMP, which X^Tu uses reduction operation.
                (This implementation combines the Hv operation.)
liblr-ompsp   - LIBLINEAR that implements parallelization by OpenMP, which X^Tu uses reduction operation.
                (This implementation doesn't combine the Hv operation.)
liblr-rsb     - LIBLINEAR that implements parallelization by librsb.
liblr-rsbX    - LIBLINEAR that implements parallelization by librsb, with X^T stored, and uses Xv subroutine everytime.
				
