Installing Victor
This Web page describes how to set up VICTOR and run a simple example. It is assumed that the target user of the system has basic familiarity with the Linux Operating System.
This documentation is created to be compatible with Red Hat Linux Operating System running the bash shell. You might need to do minor modifications to the commands based on your environment. You do NOT need to have root access to your working machine in order to set up and run VICTOR.
First download the source code (either .tar.gz or .zip, whichever is more convenient for you) from the download page. You also need to install the following packages in order to run VICTOR. The source code and examples in the Victor release are compatible with the versions in parentheses. You might need to do minor modifications to the steps/commands based on the version of the package that you use.
Pre-Installation
For the rest of the document, "VICTOR_SQL" refers to the base Victor directory that contains the setup folder. (for example, /scratch/VICTOR_SQL/). The file names that are not specified with the complete path reside in the VICTOR_SQL/setup directory.
Before proceeding:
- Make sure that you have all the tar.gz files for the above packages in the VICTOR_SQL/setup folder.
- Also download the setuptools compatible with your ANTLR version and place it in the setup folder. The file should be called something like: setuptools-0.6c5-py2.7.egg
- Make sure that install_packages.sh and install_victor.sh are executable.
$ chmod 700 install_packages.sh $ chmod 700 install_victor.sh
Install Packages
You can install each of the above packages individually. However, for your convenience we have provided a script that installs all the packages for you.
Open the install_packages.sh and update the header variables based on your package versions:
Open VICTOR_SQL/setup/computer.path.src and update the environment variables to be consistent with your install_packages.sh modifications. For example, you could replace <Victor base path> with /scratch/VICTOR_SQL and <installation path> with /scratch/VICTOR_SQL/Packages. Regardless in which directory you choose to install the packages, you must put the full path to it in this file. For convenience, you can add the content of this file to your .bashrc file (usually located in your home directory) so that you do not have to run computer.path.src for every bash shell that you open. Please note that while the source and build directories are the same (VICTOR_SQL/setup) the installation directory must be distinct.
Set the environment variables and run the bash script VICTOR_SQL/setup/install_packages.sh. This is shown below, where <base_dir> is the full path (without a trailing slash) to the directory where you want your Python and PostgreSQL installed (matches <installation path> in computer.path.src). You must create this folder. Any previous Python and PostgreSQL installations with the same folder names as those you have specified in the script will be deleted and re-installed.
If you are encountering any errors in the installation, take a look at the contents of the script. The script is heavily commented and can give you an idea of what could have gone wrong.
$ source VICTOR_SQL/setup/computer.path.src $ mkdir <base_dir> $ VICTOR_SQL/setup/install_packages.sh <base_dir>
Expected Output
You should see that the installation is progressing.
On success you should get the message "Success: Victor package installation complete." as shown below.
If you are not successful, you can safely re-run the script after solving the issue that caused the interrupt in the process.
Set up Database
To set up the PostgreSQL database, follow the steps below:
- Create a folder to store the database data:
$ mkdir VICTOR_SQL/SQL_DATA
- Initialize the database server:
$ cp VICTOR_SQL/setup/postgresql-9.0.4/src/backend/postgres VICTOR_SQL/setup/postgresql-9.0.4/src/bin/initdb/ $ VICTOR_SQL/setup/postgresql-9.0.4/src/bin/initdb/initdb -D VICTOR_SQL/SQL_DATA/
- Startup the database server:
$ VICTOR_SQL/setup/postgresql-9.0.4/src/bin/pg_ctl/pg_ctl start -l logfile -D VICTOR_SQL/SQL_DATA/ -p VICTOR_SQL/setup/postgresql-9.0.4/src/backend/postgres
- On success you should get this message: "server starting"
- You can run the following command to make sure PostgreSQL server is running (look for the command you used to start the server):
$ ps auxw | grep post
If this does not work, you may want to refer to a postgresql manual.
- If you have root access, you can copy the above pg_ctl command (with full path) to the /etc/rc.d/rc.local file so that the server starts each time your computer boots up.
- Add the necessary database paths to the environment variable $PATH. Again, you might prefer to add the commands below to your .bashrc file.
$ export PATH=$PATH:VICTOR_SQL/setup/postgresql-9.0.4/src/bin/psql/ $ export PATH=$PATH:VICTOR_SQL/setup/postgresql-9.0.4/src/bin/scripts/
- Create the database and the root user
$ createuser Enter name of role to add: root Shall the new role be a superuser? (y/n) y $ createdb test_victor
Set up Victor
Follow the steps below to set up Victor:
- Run the bash script VICTOR_SQL/setup/install_victor.sh
$ VICTOR_SQL/setup/install_victor.sh
- Run VICTOR_SQL/setup/library_setup.sql on the database
$ psql -d test_victor -f VICTOR_SQL/setup/library_setup.sql
- Run VICTOR_SQL/setup/create_major_tables.sql on the database
$ psql -d test_victor -f VICTOR_SQL/setup/create_major_tables.sql
- Make sure VICTOR_SQL/bin/victor_front.py is executable
$ chmod 700 VICTOR_SQL/bin/victor_front.py
- Test victor_front basic functionality:
$ VICTOR_SQL/bin/victor_front.py usage: victor_front.py [-h] [--forcemm FORCEMM] specfile victor_front.py: error: too few arguments
Congratulations! If you were able to get the usage message, this means that you have set up Victor correctly so far.
Load the Data
The data file is large and you need to modify it to use your username and the VICTOR_SQL path that you are using. You can achieve this by following the steps below:
- Replace all occurrences of <victor-user> and <VICTOR_SQL> in VICTOR_SQL/head_test_victor_sample.dump.dat to your username and full VICTOR_SQL path.
- Replace all occurrences of <victor-user> in VICTOR_SQL/tail_test_victor_sample.dump.dat to your username. This might take a few minutes
- Concatenate these files to get VICTOR_SQL/test_victor_sample.dump.dat. Remove the head and tail files as you do not need them anymore.
$ sed -i 's|<VICTOR_SQL>|<your_VICTOR_SQL_path>|g' VICTOR_SQL/head_test_victor_sample.dump.dat $ sed -i 's|<victor-user>|<your_user_name>|g' VICTOR_SQL/head_test_victor_sample.dump.dat $ sed -i 's|<victor-user>|<your_user_name>|g' VICTOR_SQL/tail_test_victor_sample.dump.dat $ cat VICTOR_SQL/head_test_victor_sample.dump.dat > VICTOR_SQL/test_victor_sample.dump.dat $ cat VICTOR_SQL/tail_test_victor_sample.dump.dat >> VICTOR_SQL/test_victor_sample.dump.dat $ rm -f VICTOR_SQL/head_test_victor_sample.dump.dat $ rm -f VICTOR_SQL/tail_test_victor_sample.dump.dat
- Run the following command to populate the database (this might take a few minutes):
$ psql -d test_victor -f VICTOR_SQL/test_victor_sample.dump.dat
Run a basic example
Examples are located in VICTOR_SQL/examples. The description for the following example and other examples can be found in the examples Web page.
Run the following command to run the logistic regression example.
$ VICTOR_SQL/bin/victor_front.py VICTOR_SQL/examples/LOGISTIC_REGRESSION/logit_l1.spec
Expected Output: You should see different phases of Victor engine running. Victor should be able to connect to the database successfully. Also, the objective values in the epochs should be decreasing. Your program should terminate without error. The following screen shots show the expected output (Divided to 2 screen shots due to length of output). Different Victor phases are identified by red text.
Extras
- If a postgresql server is already running on your computer,
then you will need to use a
different port number to run your postgresql server. Before starting the server you will
need to tell it which port to use:
$ export PGPORT=8000
where 8000 may be replaced by any port number you want to use other than ports already in use (5432 is the default for postgresql). Then anytime you use psql you will need to specify the port, for example$ psql -p 8000 -d test_victor
where test_victor is the name of the database you want to use. You will probably also have to modify VICTOR_SQL/sys_appends.py by adding the line 'connectString="host=localhost port=8000 dbname=test_victor user=<your_user_name>"', where <your_user_name> is replaced appropriately.