This edition of MCJoin is functionally almost identical to that which was published in SIGMOD 2012.
- Steven Begley (sbegley@latrobe.edu.au)

BUILDING
--------
The provided solution is for Microsoft Visual Studio 2012, although with a suitable makefile it is possible to build the source on Linux with gcc.
The build system requires Boost (http://www.boost.org/) to be installed, and a BOOST_ROOT environment variable to be set. Compiled libraries should
be located in BOOST_ROOT\lib64. 

I used the following build commands to compile Boost in a suitable manner:

bjam -j4 --toolset=msvc --without-mpi variant=debug link=static runtime-link=shared,static address-model=64 define=_CRT_NONSTDC_NO_DEPRECATE define=_CRT_SECURE_NO_DEPRECATE define=_SCL_SECURE_NO_DEPRECATE stage
bjam -j4 --toolset=msvc --without-mpi variant=release link=static runtime-link=shared,static address-model=64 define=_CRT_NONSTDC_NO_DEPRECATE define=_CRT_SECURE_NO_DEPRECATE define=_SCL_SECURE_NO_DEPRECATE define=_SECURE_SCL=0 define=_HAS_ITERATOR_DEBUGGING=0 stage


CREATING DATA FILES
-------------------
The provided "mkrel" tool will build data files suitable for MCJoin. MCJoin will require two data files to execute (described later). 
mkrel accepts the following parameters:

	-o output (0 = text, 1 = binary, 2 = both) (e.g. -o2)
	-c cardinality (e.g. -c1000000)
	-s selectivity (e.g. -s0.1)
	-g skew data set (e.g. -g0.01, if not set (or -g0 then distribution is uniform))
	-m mean for skew (0..1) (e.g. -m0.5, data is skewed around the center point of the random number range)
	-a automatically generate filename (needs a hint if it is R or S)
	-z use alternate generator seed
	
For example, I use the following commands to build an R and S relation each of 1,000,000 tuple cardinality, uniform distribution, with a 10% chance 
of a given tuple in R finding a match in S:

	mkrel d:\tests\r -o2 -c1000000 -a
	mkrel d:\tests\s -o2 -c1000000 -s0.1 -a -z
	
EXECUTING MCJOIN
----------------
The MCJoin executable requires one parameter:
	-cPATH_TO_CONFIG_FILE
	
For example:
	-cd:\tests\batch\config.txt
	
CONFIG FILES
------------
The config files contain the operating parameters for the current instance of MCJoin. It is a text file with the following lines:

Thread count (ignored in this version of MCJoin).
Bit radix length (this is the basis of the compression system - see the MCJoin paper).
Maximum number of bits processed per Flip Flop Buffer pass.
Memory constraint (in MB, set to 0 for no constraint)
Maximum number of tuples to store in Packed Partition Memory (ignored if memory constraint is set).
Maximum number of tuples to process per Flip Flop Buffer iteration (ignored if memory constraint is set).
Output buffer size (in tuples)
Read binary relation file (true/false, binary relations load faster).
Path to R relation
Path to S relation

CONFIG FILE EXAMPLES
--------------------

The following config file uses no memory constraint and will process relations of 1 million tuple cardinality in the least number 
of passes:
1
24
8
0
1000000
1000000
100000
true
d:\tests\relations\R_U_1M
d:\tests\relations\S_U_10P_1M

This config file will set a 128MB memory constraint:
1
24
8
128
0
0
100000
true
d:\tests\relations\R_U_1M
d:\tests\relations\S_U_10P_1M

RESULT OUTPUT
-------------
The following results are written to the standard output stream in a comma delimited format:

Number of threads
Bit radix length
Maximum bits per flip-flop buffer pass
Memory constraint (in MB)
Pack partition memory cardinality
Flip-flop buffer cardinality
Output buffer cardinality
Filename of R relation
Filename of S relation
Number of matched tuples
Total execution time (in seconds)
Time spent in flip-flop buffer of R
Time spent in flip-flop buffer of S
Time spent scattering into packed partition memory
Time spent join probing
Time spent restitching tuples (is a subset of join probing time)
R bias (i.e. percentage of memory allocated to packed partition memory over flip-flop buffer)
Number of R chunks processed
Number of S chunks processed

