250#include "constants.h"
253#include "../config.h"
255#ifdef JOIN_RESULT_MATERIALIZE
259#if !defined(__cplusplus)
260int getopt(
int argc,
char *
const argv[],
261 const char *optstring);
292extern int optind, opterr, optopt;
299static struct algo_t algos [] =
318parse_args(
int argc,
char ** argv,
param_t * cmd_params);
321main(
int argc,
char ** argv)
331 if (sched_setaffinity(0,
sizeof(set), &set) <0) {
332 perror(
"sched_setaffinity");
339 cmd_params.algo = &algos[0];
340 cmd_params.nthreads = 2;
342 cmd_params.r_size = 128000000;
343 cmd_params.s_size = 128000000;
344 cmd_params.r_seed = DEFAULT_R_SEED;
345 cmd_params.s_seed = DEFAULT_S_SEED;
346 cmd_params.skew = 0.0;
347 cmd_params.verbose = 0;
348 cmd_params.perfconf = NULL;
349 cmd_params.perfout = NULL;
350 cmd_params.nonunique_keys = 0;
351 cmd_params.fullrange_keys = 0;
352 cmd_params.basic_numa = 0;
354 cmd_params.loadfileS = NULL;
356 parse_args(argc, argv, &cmd_params);
365 "[INFO ] %s relation R with size = %.3lf MiB, #tuples = %llu : ",
366 (cmd_params.loadfileS != NULL)?(
"Loading"):(
"Creating"),
367 (
double)
sizeof(
tuple_t) * cmd_params.r_size/1024.0/1024.0,
375 nthreads = cmd_params.nthreads;
381 else if(cmd_params.fullrange_keys) {
384 else if(cmd_params.nonunique_keys) {
393 fprintf(stderr,
"OK \n");
397 "[INFO ] %s relation S with size = %.3lf MiB, #tuples = %lld : ",
398 (cmd_params.loadfileS != NULL)?(
"Loading"):(
"Creating"),
399 (
double)
sizeof(
tuple_t) * cmd_params.s_size/1024.0/1024.0,
405 if(cmd_params.loadfileS != NULL){
407 load_relation(&relS, cmd_params.loadfileS, cmd_params.s_size);
409 else if(cmd_params.fullrange_keys) {
412 else if(cmd_params.nonunique_keys) {
419 if(cmd_params.skew > 0){
422 cmd_params.r_size, cmd_params.skew);
432 fprintf(stderr,
"OK \n");
436 fprintf(stderr,
"[INFO ] Running join algorithm %s ...\n", cmd_params.algo->name);
439 results = cmd_params.algo->joinAlgo(&relR, &relS, cmd_params.nthreads);
441 fprintf(stderr,
"[INFO ] Results = %llu. DONE.\n", results->totalresults);
443#if (defined(PERSIST_RELATIONS) && defined(JOIN_RESULT_MATERIALIZE))
444 fprintf(stderr,
"[INFO ] Persisting the join result to \"Out.tbl\" ...\n");
445 write_result_relation(results,
"Out.tbl");
452#ifdef JOIN_RESULT_MATERIALIZE
453 free(results->resultlist);
461print_help(
char * progname)
463 printf(
"Usage: %s [options]\n", progname);
466 Join algorithm selection, algorithms : RJ, PRO, PRH, PRHO, NPO, NPO_st \n\
467 -a --algo=<name> Run the hash join algorithm named <name> [PRO] \n\
469 Other join configuration options, with default values in [] : \n\
470 -n --nthreads=<N> Number of threads to use <N> [2] \n\
471 -r --r-size=<R> Number of tuples in build relation R <R> [128000000]\n\
472 -s --s-size=<S> Number of tuples in probe relation S <S> [128000000]\n\
473 -x --r-seed=<x> Seed value for generating relation R <x> [12345] \n\
474 -y --s-seed=<y> Seed value for generating relation S <y> [54321] \n\
475 -z --skew=<z> Zipf skew parameter for probe relation S <z> [0.0] \n\
476 -R --r-file=<Rf> The file to load build relation R from <Rf> [R.tbl] \n\
477 -S --s-file=<Sf> The file to load probe relation S from <Sf> [S.tbl] \n\
478 --non-unique Use non-unique (duplicated) keys in input relations \n\
479 --full-range Spread keys in relns. in full 32-bit integer range \n\
480 --basic-numa Numa-localize relations to threads (Experimental) \n\
482 Performance profiling options, when compiled with --enable-perfcounters. \n\
483 -p --perfconf=<P> Intel PCM config file with upto 4 counters [none] \n\
484 -o --perfout=<O> Output file to print performance counters [stdout] \n\
486 Basic user options \n\
487 -h --help Show this message \n\
488 --verbose Be more verbose -- show misc extra info \n\
489 --version Show version \n\
496 printf(
"\n%s\n", PACKAGE_STRING);
497 printf(
"Copyright (c) 2012, 2013, ETH Zurich, Systems Group.\n");
498 printf(
"http://www.systems.ethz.ch/projects/paralleljoins\n\n");
502mystrdup (
const char *s)
504 char *ss = (
char*) malloc (strlen (s) + 1);
507 memcpy (ss, s, strlen(s) + 1);
513parse_args(
int argc,
char ** argv,
param_t * cmd_params)
518 static int verbose_flag;
519 static int nonunique_flag;
520 static int fullrange_flag;
521 static int basic_numa;
524 static struct option long_options[] =
527 {
"verbose", no_argument, &verbose_flag, 1},
528 {
"brief", no_argument, &verbose_flag, 0},
529 {
"non-unique", no_argument, &nonunique_flag, 1},
530 {
"full-range", no_argument, &fullrange_flag, 1},
531 {
"basic-numa", no_argument, &basic_numa, 1},
532 {
"help", no_argument, 0,
'h'},
533 {
"version", no_argument, 0,
'v'},
536 {
"algo", required_argument, 0,
'a'},
537 {
"nthreads",required_argument, 0,
'n'},
538 {
"perfconf",required_argument, 0,
'p'},
539 {
"r-size", required_argument, 0,
'r'},
540 {
"s-size", required_argument, 0,
's'},
541 {
"perfout", required_argument, 0,
'o'},
542 {
"r-seed", required_argument, 0,
'x'},
543 {
"s-seed", required_argument, 0,
'y'},
544 {
"skew", required_argument, 0,
'z'},
545 {
"r-file", required_argument, 0,
'R'},
546 {
"s-file", required_argument, 0,
'S'},
550 int option_index = 0;
552 c = getopt_long (argc, argv,
"a:n:p:r:s:o:x:y:z:R:S:hv",
553 long_options, &option_index);
562 if (long_options[option_index].flag != 0)
564 printf (
"option %s", long_options[option_index].name);
566 printf (
" with arg %s", optarg);
572 while(algos[i].joinAlgo) {
573 if(strcmp(optarg, algos[i].name) == 0) {
574 cmd_params->algo = &algos[i];
582 printf(
"[ERROR] Join algorithm named `%s' does not exist!\n",
602 cmd_params->nthreads = atoi(optarg);
606 cmd_params->perfconf = mystrdup(optarg);
610 cmd_params->r_size = atol(optarg);
614 cmd_params->s_size = atol(optarg);
618 cmd_params->perfout = mystrdup(optarg);
622 cmd_params->r_seed = atoi(optarg);
626 cmd_params->s_seed = atoi(optarg);
630 cmd_params->skew = atof(optarg);
634 cmd_params->
loadfileR = mystrdup(optarg);
638 cmd_params->loadfileS = mystrdup(optarg);
649 cmd_params->nonunique_keys = nonunique_flag;
650 cmd_params->verbose = verbose_flag;
651 cmd_params->fullrange_keys = fullrange_flag;
652 cmd_params->basic_numa = basic_numa;
656 printf (
"non-option arguments: ");
657 while (optind < argc)
658 printf (
"%s ", argv[optind++]);
Affinity methods on Mac OS X. Mac OS X does not export interfaces that identify processors or control...
Provides methods to generate data sets of various types.
int create_relation_fk_from_pk(relation_t *fkrel, relation_t *pkrel, int64_t num_tuples)
int create_relation_nonunique(relation_t *relation, int64_t num_tuples, const int64_t maxid)
int parallel_create_relation(relation_t *relation, uint64_t num_tuples, uint32_t nthreads, uint64_t maxid)
void delete_relation(relation_t *rel)
int create_relation_zipf(relation_t *relation, int64_t num_tuples, const int64_t maxid, const double zipf_param)
void seed_generator(unsigned int seed)
int load_relation(relation_t *relation, char *filename, uint64_t num_tuples)
result_t * NPO(relation_t *relR, relation_t *relS, int nthreads)
result_t * NPO_st(relation_t *relR, relation_t *relS, int nthreads)
result_t * PRH(relation_t *relR, relation_t *relS, int nthreads)
result_t * PRO(relation_t *relR, relation_t *relS, int nthreads)
result_t * RJ(relation_t *relR, relation_t *relS, int nthreads)
result_t * PRHO(relation_t *relR, relation_t *relS, int nthreads)
The interface of No partitioning optimized (NPO) join algorithm.
Provides interfaces for several variants of Radix Hash Join.
An interface to the Intel Performance Counters Monitoring.
Implements a chained-buffer storage model for tuples.