Software Open Access

# syhlalala/PAM-AE: PAM

syhlalala

### Citation Style Language JSON Export

{
"DOI": "10.5281/zenodo.1168703",
"abstract": "PAM\n<p>PAM (Parallel Augmented Maps) is a parallel C++ library implementing the interface for augmented maps [1].  It is designed for maintaining an ordered map data structure while efficiently answering range-based and related queries.    In the experiments we use the interface in four examples: augmented-sums, interval-queries, 2d range-queries, and an inverted index.    The released code includes the examples and scripts for running the specific experiments reported in the paper.   It is also designed so it is easy to try in many other scenarios (different sizes, different numbers of cores, and other operations described in the paper, but not reported in the experiments).</p>\n<p>More details and examples can be found in our paper [1].</p>\nUsage:\n<p>To define an augmented map using PAM, user need to specify the parameters including type names and (static) functions in the entry structure entry''.</p>\n<ul>\n<li>typename key_t: the key type (K),</li>\n<li>function comp: K x K -&gt; bool: the comparison function on K (&lt;_K)</li>\n<li>typename val_t: the value type (V),</li>\n<li>typename aug_t: the augmented value type (A),</li>\n<li>function from_entry: K x V -&gt; A: the base function (g)</li>\n<li>function combine: A x A -&gt; A: the combine function (f)</li>\n<li>function get_empty: empty -&gt; A: the identity of f (I)</li>\n</ul>\n<p>Then an augmented map is defined with C++ template as</p>\n<pre><code>augmented_map&lt;entry&gt;.\n</code></pre>\n<p>Note that a plain ordered map is defined as an augmented map with no augmentation (i.e., it only has K, &lt;_K and V in its entry) and a plain ordered set is similarly defined as an augmented map with no augmentation and no value type.</p>\n<p>Here is an example of defining an augmented map \"m\" that has integer keys and values and is augmented with value sums (similar as the augmented sum example in our paper [1]):</p>\n<pre><code>struct entry {\n  using key_t = int;\n  using val_t = int;\n  using aug_t = int;\n  static bool comp(key_t a, key_t b) { \n    return a &lt; b;}\n  static aug_t get_empty() { return 0;}\n  static aug_t from_entry(key_t k, val_t v) { \n    return v;}\n  static aug_t combine(aug_t a, aug_t b) { \n    return a+b;}};\naugmented_map&lt;entry&gt; m;\n</code></pre>\n<p>Another quick example can be found in [1], which shows how to implement an interval tree using the PAM interface.</p>\nHardware dependencies\n<p>Any modern (2010+) x86-based multicore machines.  Relies on 128-bit CMPXCHG (requires -mcx16 compiler flag) but does not need hardware transactional memory (TSX).  Most examples given in our scripts require 64GB memory, but range_query requires 256GB memory and aug_sum on the large input requires 1TB memory.  All the examples can take smaller input size by setting command line arguments.</p>\nSoftware dependencies\n<p>PAM requires g++ 5.4.0 or later versions supporting the Cilk Plus extensions.    The scripts that we provide in the repository use \"numactl\" for better performance. All tests can also run directly without \"numactl\".</p>\n<p>We use python to write a script to organize all results and compute speedup. It is not required to run tests.</p>\nDatasets\n<p>We use the publicly available Wikipedia database (dumped on Oct. 1, 2016) for the inverted index experiment.  We release a sample (1% of total size) in the github repository (35MB compressed).  The full data (3.5TB compressed) is available on request.  All other applications use randomly generated data.</p>\nExperiment Workflow:\n<p>At the top level there is a makefile (make) and a script for compiling and running all timings (./run_all).  The source code\nof the library is provided in the directory c++/, and the other directories\neach corresponds to some examples of applications. There are\nfour example applications provided in our repository:</p>\n<ul>\n<li>The range sum (in directory aug_sum/).</li>\n<li>The interval tree (in directory interval/).</li>\n<li>The range tree (in directory range_query/).</li>\n<li>The inverted indices (in directory index/).</li>\n</ul>\n<p>In each of the directories there is a separated makefile and a script to run the timings for the corresponding application.</p>\n<p>All tests include parallel and sequential running times.  The sequential versions are the algorithms running directly on one thread, and the parallel versions use all threads on the machine using \"numactl -i all\".</p>\n<p>To run all tests, just type the following at the top level:</p>\n<pre><code>make\n./run_all.sh\n</code></pre>\n<p>By default the script will not include the tests on very large input sizes (10 billion), which costs long. Users can use</p>\n<pre><code>make\n./run_all.sh -l\n</code></pre>\n<p>to include large tests.</p>\n<p>To run separated tests on each application, users can also go to each sub-directory to run the scripts.</p>\n<p>We recommend to use numactl -i all on all parallel tests.</p>\nAugmented Sum (/aug_sum/)\n<p>Using</p>\n<pre><code>make\n</code></pre>\n<p>will give two executable files aug_sum (augmented version) and aug_sumNA (non-augmented version). This is done by setting flag -DNO_AUG in compiling time.</p>\n<p>Using</p>\n<pre><code>./run_aug_sum.sh -l\n</code></pre>\n<p>will run all experiments as shown in Table 3 in [1] on augmented sum. If you do not want to run on large input, remove \"-l\".</p>\n<p>Using</p>\n<pre><code>./runall [-r rounds] [-p threads]\n</code></pre>\n<p>will run all functions as shown in Table 3 in [1] with 'rounds' rounds and 'threads' threads. By default rounds=3 and threads=<code>nproc --all</code> (maximum number of threads on the machine).</p>\n<p>Both scripts will output to both stdout and a file res.txt. The script run_aug_sum.sh will then call a python code to give all results (timings and speedups) in a file data.txt.</p>\n<p>If user wants to directly run our executable file (aug_sum or aug_sumNA), the arguments are listed as follows:</p>\n<pre><code>./aug_sum [-n size1] [-m size2] [-r rounds] [-p] &lt;testid&gt;\n</code></pre>\nInterval Tree (/interval/)\n<p>Using</p>\n<pre><code>make\n</code></pre>\n<p>will give the executable file (interval).</p>\n<p>Using</p>\n<pre><code>run_interval\n</code></pre>\n<p>will give the same experiment of interval trees as shown in Table 5 in [1].</p>\n<p>To directly run the executable file (interval), one can try:</p>\n<pre><code>./interval n q r\n</code></pre>\n<p>where n stands for the number of intervals, q is the number of querys, r is the number of rounds. By default n=100000000, q=n, r=5.</p>\nRange Tree (/range_query/)\n<p>Using</p>\n<pre><code>make\n</code></pre>\n<p>will give the executable file (rt_test).</p>\n<p>Using</p>\n<pre><code>./run_range\n</code></pre>\n<p>will give the same experiment of range trees as shown in Table 5 in [1].</p>\n<p>To directly run the executable file (rt_test), one can try:</p>\n<pre><code>./rt_test [-n size] [-l rmin] [-h rmax] [-r rounds] [-q queries] [-w window] [-t query_type]\n</code></pre>\n<p>where 'size' stands for the number of points, 'rmin' and 'rmax' are the upper and lower bound of coordinates, 'rounds' is the number of rounds, 'queries' is the number of queries, 'window' is the query window size (for one dimension), 'query_type' is 0 for query-all, and 1 for query-ssum. By default n=100000000, l=0, h=1000000000, r=3, q=1000, w=1000000, t=0.</p>\nInverted Index\n<p>Using</p>\n<pre><code>make\n</code></pre>\n<p>will give the executable file (index).</p>\n<p>Using</p>\n<pre><code>./run_index\n</code></pre>\n<p>will give the same type of experiment of inverted index as shown in Table 6 in [1], but on a smaller input size.</p>\n<p>To directly run the executable file (index), one can try:</p>\n<pre><code>./index [-o] [-v] [-n max_chars] [-q num_queries] [-f file]\n</code></pre>\n<p>where '-o' indicates an output file of query results, '-v' means to output verbose information, '-n' means the length to read from a file, '-q' is the number of queries, and '-f' is the input file. By default n=1000000000000 (just read the whole file), q=10000, f='wiki_small.txt'.</p>\nReference\n<p>[1] Yihan Sun, Daniel Ferizovic, and Guy E. Blelloch. PAM: Parallel Augmented Maps. PPoPP 2018.</p>",
"author": [
{
"family": "syhlalala"
}
],
"id": "1168703",
"issued": {
"date-parts": [
[
2018,
2,
7
]
]
},
"publisher": "Zenodo",
"title": "syhlalala/PAM-AE: PAM",
"type": "article",
"version": "v1.0"
}
37
0
views