Getting Started

Getting Started


Obtaining Sources

RevKit can be downloaded from the www.revkit.org website.


Required Dependencies

RevKit has the following requirements:

Further requirements are boost 1.51.0, CUDD, cuddread, and PUMA. Their sources will be automatically downloaded and compiled during the bootstrap of the installation (see below). This process may take some time.


Overview of the Directory Structure

The following table lists the names of all directories and a short description.

Directory Description
build Build directory which is created by the ./build.sh script
doc Source code documentation and user manual
helpers Helper scripts for code-stub generation
scripts Scripts for the bootstrap and build process
src/algorithms stable algorithms (e.g. for synthesis, optimization, ...)
src/bindings Code for the Python bindings
src/core Core library with basic data structures and functions
src/examples C++ First Steps examples from this documentation.
src/unstable Unstable algorithms (under development)
libs Third party dependencies
tools Small python scripts for stand-alone usage of the algorithms

Installation (Initial Building)

In order to install RevKit, go to the directory to where you checked out the sources (i.e. where you find directories like src, scripts, tools ...). Then, perform the following steps:

$ ./make.py bootstrap

This will initialize the revkit directory with the depending libraries. So this step has to be performed once. In this process, compiling boost takes some time. If you already have installed boost using the distribution's package manager, the option -DBOOST_PATH can be used to specify its path, e.g. -DBOOST_PATH=/usr. Alternatively you can specify the boost include and libs path separately by using –boost, –boost-include-dir and –boost-lib-dir as arguements. If there are multiple versions of python installed on the system and boost is compiled to utilize all versions, there may be no libboost_python library (link) but several libboost_python-* libraries. In that case a symlink to libboost_python-2.* located at the lib or your revkit/libs directory will solve this problem. Afterwards the Revkit algorithms can be compiled. To do so, call:

$ ./make.py build

This will compile the core, algorithms, examples, and the Python bindings. If for some reason the Python bindings cannot be compiled or if they are not required, they can be dactivated by adding the -DBUILD_BINDINGS=OFF option:

$ ./make.py build -DBUILD_BINDINGS=OFF

If you want to install the library to certain location (which is not necessary), you can use -DCMAKE_INSTALL_PREFIX, e.g.:

$ ./make.py bootstrap -DCMAKE_INSTALL_PREFIX=/usr
$ cd build
$ make install

Of course, all the options can be combined and also changed after the initial building, e.g. with the cmake-gui:

$ cd build
$ cmake-gui ..

Compiling (After Initial Build)

If you added a new C++ based algorithm to RevKit or modified the existing ones, there is no need to run ./make.py build again. But it's still possible. Instead, you can compile your extensions by simply entering:

$ cd build
$ make

Hint: The libraries and executables that were built are in the respective sub-directories, e.g. build/core, build/examples, ...


Boost for RevKit Users

Internally, RevKit extensively uses the Boost libraries. Some of the concepts might also be useful for extensions. Thus, in the following two of the Boost libraries are motivated by means of small examples.

Boost.Assignment

Boost.Assignment makes it easier to insert elements into containers. This is illustrated by the following example, where names are added to a vector of std::string.

#include <string>
#include <vector>
#include <boost/assign/std/vector.hpp>
using namespace boost::assign;
using namespace revkit;
int main( int argc, char ** argv )
{
std::vector<std::string> names;
names += "Ada","Bob","Cipher";
return 0;
}

This example also works e.g. with std::set.

Boost.Foreach

Boost.Foreach enables a foreach - style loop inside C++. This construct internally uses efficient C++ iterator techniques, so it is safe to use from this point of view. The following small example demonstrates how to use Boost.Foreach in order to loop through a vector of strings which was former created by Boost.Assign (see above). Note, that we defined a macro to call BOOST_FOREACH foreach in order to make it more readable.

#include <string>
#include <vector>
#include <boost/assign/std/vector.hpp>
#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH
using namespace boost::assign;
using namespace revkit;
int main( int argc, char ** argv )
{
std::vector<std::string> names;
names += "Ada","Bob","Cipher";
foreach ( const std::string& name, names )
{
std::cout << "Name: " << name << std::endl;
}
return 0;
}

Boost.Format

Boost.Format gives you a C++ alternative to C's printf. In the following example, first a string is printed out to the standard output and, afterwards, another string is generated. All known placeholders and format options of printf can be used.

#include <iostream>
#include <string>
#include <boost/format.hpp>
int main( int argc, char ** argv )
{
std::cout << boost::format( "Gates: %d, Runtime: %f" ) % 12 % 3.44;
std::string s = boost::str( boost::format( "Quantum costs: %d" ) % 42 );
return 0;
}

Generated on Tue Apr 16 2013 08:12:02 for RevKit by doxygen 1.8.3.1