Esempio n. 1
0
/***********************************************************************
 *              process_attach
 */
static BOOL process_attach(void)
{
    SessionAttributeBits attributes;
    OSStatus status;

    status = SessionGetInfo(callerSecuritySession, NULL, &attributes);
    if (status != noErr || !(attributes & sessionHasGraphicAccess))
        return FALSE;

    setup_options();

    if ((thread_data_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;

    macdrv_err_on = ERR_ON(macdrv);
    if (macdrv_start_cocoa_app(GetTickCount64()))
    {
        ERR("Failed to start Cocoa app main loop\n");
        return FALSE;
    }

    set_app_icon();
    macdrv_clipboard_process_attach();

    return TRUE;
}
Esempio n. 2
0
int main(int argc, const char **argv)
{
  slipstore::io *streams;
  rtc_clock prefill_clock;
  rtc_clock drain_clock;
  /* Get options */
  setup_options(argc, argv);
  slipchunk = vm["slipchunk"].as<unsigned long>();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::SLIPCHUNK "
			  << slipchunk;
  unsigned long slipfile_size = vm["slipbench_fsize"].as<unsigned long>();
  unsigned long blockmem = vm["blocked_memory"].as<unsigned long>();
  unsigned long prefill  = vm["test_prefill"].as<unsigned long>();
  /* Read in slipstore information */
  init_slipstore_desc();
  unsigned long fanout = vm["ext_fanout"].as<unsigned long>();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::FANOUT_UNDER_TEST "
			  << fanout;
  streams = new slipstore::io(1, 1, fanout, NULL);
  slipstore::init(streams, 100, 1); // tilesize does not matter
  unsigned char *buffer = new unsigned char[slipchunk];
  choice   = new slipstore::cyclic(fanout,
				   slipstore::slipstore_client_drain->get_me());
  if(blockmem > 0) {
    BOOST_LOG_TRIVIAL(info) << "Blocking " << blockmem;
    (void)map_anon_memory(blockmem, true, "Blockmem");
    BOOST_LOG_TRIVIAL(info) << "Done";
  }
  unsigned long drain_bytes = slipfile_size;
  if(drain_bytes < 2*fanout*slipchunk) {
    drain_bytes = 2*fanout*slipchunk;
  }
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::PREFILL "
			  << prefill;
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::DRAIN_AMOUNT "
			  << drain_bytes;
  /////////// Prefill
  control_barrier(); // everyone started
  prefill_clock.start();
  drain_test(buffer, prefill);
  prefill_clock.stop();
  control_barrier(); // everyone done
  prefill_clock.print("SLIPBENCH::PREFILL_TIME ");
  ////////// Drain test
  control_barrier(); // everyone started
  drain_clock.start();
  drain_test(buffer, drain_bytes);
  control_barrier(); // everyone done
  // Flush the remaining blocks
  for(unsigned long i=0;i<fanout;i++) {
    streams->rewind(slipstore::STREAM_VERTEX_STATE, 0, i);
  }
  drain_clock.stop();
  drain_clock.print("SLIPBENCH::DRAIN_TIME ");
  ///////////////////////
  slipstore::shutdown();
  delete buffer;
  delete streams;
  
}
Esempio n. 3
0
InputParameters validParams<RandomElementalUserObject>()
{
  InputParameters params = validParams<ElementUserObject>();

  MooseEnum setup_options(SetupInterface::getExecuteOptions());
  setup_options = "timestep_begin";
  params.set<MooseEnum>("execute_on") = setup_options;
  return params;
}
Esempio n. 4
0
InputParameters validParams<ConservedNoiseBase>()
{
  InputParameters params = validParams<ElementUserObject>();

  MultiMooseEnum setup_options(SetupInterface::getExecuteOptions());
  setup_options = "timestep_begin";
  params.set<MultiMooseEnum>("execute_on") = setup_options;
  return params;
}
InputParameters validParams<ConservedMaskedNoiseBase>()
{
  InputParameters params = validParams<ElementUserObject>();

  MultiMooseEnum setup_options(SetupInterface::getExecuteOptions());
  setup_options = "timestep_begin";
  params.set<MultiMooseEnum>("execute_on") = setup_options;
  params.addParam<MaterialPropertyName>("mask", "Material property to multiply the random numbers with");
  return params;
}
int
main (int argc, char **argv)
{
	GOptionContext *context;
	GladeXML       *gui;
	char           *gladefile;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	context = g_option_context_new ("");

	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

	gnome_program_init (argv [0], "0.0.0.0", LIBGNOMEUI_MODULE,
			    argc, argv,
			    GNOME_PARAM_GOPTION_CONTEXT, context,
			    GNOME_PARAM_NONE);

	g_option_context_free (context);

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		return 0;
	}

	gladefile = PANEL_APPLET_GLADEDIR "/panel-test-applets.glade";
	gui = glade_xml_new (gladefile, "toplevel", NULL);
	if (!gui) {
		g_warning ("Error loading `%s'", gladefile);
		return 1;
	}

	glade_xml_signal_autoconnect (gui);

	win             = glade_xml_get_widget (gui, "toplevel");
	applet_combo    = glade_xml_get_widget (gui, "applet-combo");
	prefs_dir_entry = glade_xml_get_widget (gui, "prefs-dir-entry");
	orient_combo    = glade_xml_get_widget (gui, "orient-combo");
	size_combo      = glade_xml_get_widget (gui, "size-combo");

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	return 0;
}
Esempio n. 7
0
InputParameters validParams<DiscreteNucleationMap>()
{
  InputParameters params = validParams<ElementUserObject>();
  params.addParam<Real>("radius", 0.0, "Radius for the inserted nuclei");
  params.addParam<Real>("int_width", 0.0, "Nucleus interface width for smooth nuclei");
  params.addRequiredParam<UserObjectName>("inserter", "DiscreteNucleationInserter user object");
  params.addCoupledVar("periodic", "Use the periodicity settings of this variable to populate the grain map");
  MultiMooseEnum setup_options(SetupInterface::getExecuteOptions());
  // the mapping needs to run at timestep begin, which is after the adaptivity
  // run of the previous timestep.
  setup_options = "timestep_begin";
  params.set<MultiMooseEnum>("execute_on") = setup_options;
  return params;
}
Esempio n. 8
0
init(void)
{ callocp   = (void*(*)(size_t,size_t))dlsym(RTLD_NEXT, "calloc");
  mallocp   = (void*(*)(size_t))       dlsym(RTLD_NEXT, "malloc");
  reallocp  = (void*(*)(void*,size_t)) dlsym(RTLD_NEXT, "realloc");
  freep     = (void (*)(void *))       dlsym(RTLD_NEXT, "free");

  no_hook = TRUE;
  setup_options();
  logfd = fopen(DL_logfile, "w");
  no_hook = FALSE;

  unsetenv("LD_PRELOAD");		/* do not inject in sub-processes */
#ifdef EXIT_DUMP_CONTEXTS
  atexit(dump_contexts);
#endif
}
Esempio n. 9
0
void setup(gpgme_ctx_t * context, telem_gpg_opts * options) {
  gpgme_error_t error;
  // gpgme_engine_info_t info;

  // Set the defaults
  setup_options(options);
  /* Initializes gpgme */
  gpgme_check_version (NULL);

  /* Initialize the locale environment.  */
  setlocale (LC_ALL, "");
  gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
#ifdef LC_MESSAGES
  gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
#endif

  error = gpgme_new(context);
  fail_if_err(error);
  /* Setting the output type must be done at the beginning */
  gpgme_set_armor(*context, 1);

  /* Check OpenPGP */
  // error = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
  // fail_if_err(error);
  // error = gpgme_get_engine_info (&info);
  // fail_if_err(error);
  // while (info && info->protocol != gpgme_get_protocol(*context)) {
  //   info = info->next;
  // }
  // /* TODO: we should test there *is* a suitable protocol */
  // fprintf (stderr, "Engine OpenPGP %s is installed at %s\n", info->version,
	//    info->file_name); /* And not "path" as the documentation says */

  // Create the keyring_dir is it doesnt exist
  mkdirs(options->keyring_dir);

  /* Initializes the context */
  error = gpgme_ctx_set_engine_info(
    *context,
    GPGME_PROTOCOL_OpenPGP,
    NULL,
    options->keyring_dir
  );
  fail_if_err(error);
}
Esempio n. 10
0
int main(int argc, char *argv[]){
	return setup_options(argc,argv);
}
Esempio n. 11
0
int main(int argc, const char **argv) {
  slipstore::io *streams;
  rtc_clock fill_clock;
  rtc_clock drain_clock;
  slipstore::slipstore_req_t req;
  bool silent;
  /* Get options */
  setup_options(argc, argv);
  unsigned long slipchunk = vm["slipchunk"].as < unsigned
  long > ();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::SLIPCHUNK "
  << slipchunk;
  unsigned long slipfile_size = vm["slipbench_fsize"].as < unsigned
  long > ();
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::SLIPBENCH_FIZE "
  << slipfile_size;
  unsigned long background_threads =
  vm["slipbench_background_threads"].as < unsigned
  long > ();
  unsigned long align = vm["slipbench_align"].as < unsigned
  long > ();
  slipchunk = (slipchunk / align) * align;
  unsigned long blockmem = vm["blocked_memory"].as < unsigned
  long > ();
  /* Read in slipstore information */
  init_slipstore_desc();
  bool run_drain_test = (vm.count("drain_test") > 0);
  bool run_fill_test = (vm.count("fill_test") > 0);
  streams = new slipstore::io(1, 1, 1, NULL);
  slipstore::init(streams, 100, 1); // tilesize does not matter
  unsigned char *buffer = new unsigned char[slipchunk];
  unsigned long fill_bytes = 0;
  unsigned char *big_buffer;
  unsigned long big_bufsize = 512 * 1024 * 1024;
  if (blockmem > 0) {
    BOOST_LOG_TRIVIAL(info) << "Blocking " << blockmem;
  }
  else {
    blockmem = big_bufsize;
    BOOST_LOG_TRIVIAL(info) << "Allocating " << blockmem;
  }
  if (blockmem < big_bufsize) {
    blockmem = big_bufsize;
  }
  big_buffer = (unsigned char *) map_anon_memory(blockmem, true, "Blockmem");
  BOOST_LOG_TRIVIAL(info) << "Done ";

  bool centralized = (vm.count("centralized") > 0);
  bool batching = (vm.count("request_batching") > 0);

  unsigned long silenced_clients = vm["slipbench_silence"].as < unsigned
  long > ();
  if (silenced_clients != ULONG_MAX &&
      slipstore::slipstore_client_drain->get_me() < silenced_clients) {
    silent = true;
  }
  else {
    silent = false;
  }

  if (background_threads > 0) {
    BOOST_LOG_TRIVIAL(info) << "Starting background threads";
    for (unsigned long i = 0; i < background_threads; i++) {
      (void) new boost::thread(boost::ref(*new interference()));
    }
    while (bthread_running != background_threads);
    BOOST_LOG_TRIVIAL(info) << "done";
  }

  control_barrier(); // everyone started
  if (run_drain_test) {
    if (!silent) {
      BOOST_LOG_TRIVIAL(info) << "Starting drain test";
      drain_clock.start();
      unsigned long drain_bytes = slipfile_size;
      if (batching) {
        while (drain_bytes) {
          req.cmd = slipstore::CMD_DRAIN;
          req.stream = slipstore::STREAM_VERTEX_STATE;
          req.partition = 0;
          req.tile = 0;
          unsigned long bytes_to_drain = drain_bytes;
          if (bytes_to_drain > big_bufsize) {
            bytes_to_drain = big_bufsize;
          }
          if (slipstore::slipstore_client_drain->batch_access_store(&req,
                                                                    big_buffer,
                                                                    slipchunk,
                                                                    bytes_to_drain)) {
            BOOST_LOG_TRIVIAL(fatal) << "Unable to write to slipstore";
            exit(-1);
          }
          drain_bytes -= bytes_to_drain;
        }
      }
      else {
        while (drain_bytes) {
          unsigned long bytes;
          bytes = (drain_bytes > slipchunk) ?
                  slipchunk : drain_bytes;
          if (centralized) {
            req.cmd = slipstore::CMD_NOP;
            req.stream = slipstore::STREAM_VERTEX_STATE;
            req.partition = 0;
            req.tile = 0;
            req.size = 0;
            if (!slipstore::slipstore_client_drain->access_store(&req, buffer, 0)) {
              BOOST_LOG_TRIVIAL(fatal) << "Unable to write to slipstore";
              exit(-1);
            }
          }
          req.cmd = slipstore::CMD_DRAIN;
          req.stream = slipstore::STREAM_VERTEX_STATE;
          req.partition = 0;
          req.tile = 0;
          req.size = bytes;
          if (!slipstore::slipstore_client_drain->access_store(&req, buffer)) {
            BOOST_LOG_TRIVIAL(fatal) << "Unable to write to slipstore";
            exit(-1);
          }
          drain_bytes -= bytes;
        }
      }
      drain_clock.stop();
      BOOST_LOG_TRIVIAL(info) << "Completed drain test";
    }
    else {
      BOOST_LOG_TRIVIAL(info) << "SILENCED !";
    }
    if (run_fill_test) {
      control_barrier();
      streams->rewind(0, 0, 0);
      control_barrier();
    }
  }
  if (run_fill_test) {
    streams->fill_test_prep(slipstore::STREAM_VERTEX_STATE);
    control_barrier();
    if (!silent) {
      BOOST_LOG_TRIVIAL(info) << "Starting fill test";
      fill_clock.start();
      if (batching) {
        unsigned long filled_bytes;
        do {
          req.cmd = slipstore::CMD_FILL;
          req.stream = slipstore::STREAM_VERTEX_STATE;
          req.partition = 0;
          req.tile = 0;
          filled_bytes =
              slipstore::slipstore_client_fill->batch_access_store(&req,
                                                                   big_buffer,
                                                                   slipchunk,
                                                                   big_bufsize);
          fill_bytes += filled_bytes;
        } while (filled_bytes > 0);
      }
      else {
        do {
          if (centralized) {
            req.cmd = slipstore::CMD_NOP;
            req.stream = slipstore::STREAM_VERTEX_STATE;
            req.partition = 0;
            req.tile = 0;
            req.size = 0;
            if (!slipstore::slipstore_client_drain->access_store(&req, buffer, 0)) {
              BOOST_LOG_TRIVIAL(fatal) << "Unable to write to slipstore";
              exit(-1);
            }
          }
          req.cmd = slipstore::CMD_FILL;
          req.stream = slipstore::STREAM_VERTEX_STATE;
          req.partition = 0;
          req.tile = 0;
          req.size = slipchunk;
          if (!slipstore::slipstore_client_fill->access_store(&req, buffer)) {
            break;
          }
          fill_bytes += req.size;
        } while (true);
      }
      fill_clock.stop();
      BOOST_LOG_TRIVIAL(info) << "Completed fill test";
    }
    else {
      BOOST_LOG_TRIVIAL(info) << "SILENCED !";
    }
  }
  control_barrier(); // everyone done
  slipstore::shutdown();
  delete buffer;
  delete streams;
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::DRAIN_BYTES "
  << slipfile_size;
  drain_clock.print("SLIPBENCH::DRAIN_TIME ");
  BOOST_LOG_TRIVIAL(info) << "SLIPBENCH::FILL_BYTES "
  << fill_bytes;
  fill_clock.print("SLIPBENCH::FILL_TIME ");
}
Esempio n. 12
0
int
main (int argc, char **argv)
{
	GtkBuilder *builder;
	char       *uifile;
	char       *applets_dir;
	GError     *error;

	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	error = NULL;
	if (!gtk_init_with_args (&argc, &argv,
				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
				 &error)) {
		if (error) {
			g_printerr ("%s\n", error->message);
			g_error_free (error);
		} else
			g_printerr ("Cannot initiliaze GTK+.\n");

		return 1;
	}

	panel_modules_ensure_loaded ();

	if (g_file_test ("../libmate-panel-applet", G_FILE_TEST_IS_DIR)) {
		applets_dir = g_strdup_printf ("%s:../libmate-panel-applet", MATE_PANEL_APPLETS_DIR);
		g_setenv ("MATE_PANEL_APPLETS_DIR", applets_dir, FALSE);
		g_free (applets_dir);
	}

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		panel_cleanup_do ();

		return 0;
	}

	builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

	uifile = BUILDERDIR "/panel-test-applets.ui";
	gtk_builder_add_from_file (builder, uifile, &error);

	if (error) {
		g_warning ("Error loading \"%s\": %s", uifile, error->message);
		g_error_free (error);
		panel_cleanup_do ();

		return 1;
	}

	gtk_builder_connect_signals (builder, NULL);

	win             = GTK_WIDGET (gtk_builder_get_object (builder,
							      "toplevel"));
	applet_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "applet-combo"));
	prefs_path_entry = GTK_WIDGET (gtk_builder_get_object (builder,
							      "prefs-path-entry"));
	orient_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "orient-combo"));
	size_combo      = GTK_WIDGET (gtk_builder_get_object (builder,
							      "size-combo"));
	g_object_unref (builder);

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	panel_cleanup_do ();

	return 0;
}
Esempio n. 13
0
/**
 * Program entry point.
 *
 * "monitor" a directory and upload all of the JSON files in that
 * directory to a couchbase server.
 *
 * @param argc argument count
 * @param argv argument vector
 */
int main(int argc, char **argv)
{
    const char *spool = default_spool;
    const char *host = NULL;
    const char *user = NULL;
    const char *passwd = NULL;
    const char *bucket = NULL;
    int sleep_time = 5;
    lcb_error_t ret;
    int cmd;
    struct option opts[7];
    struct lcb_create_st create_options;


    memset(opts, 0, sizeof(opts));
    setup_options(opts);

    /* Parse command line arguments */
    while ((cmd = getopt_long(argc, argv,
                              "s:" /* spool directory */
                              "h:" /* host */
                              "u:" /* user */
                              "p:" /* password */
                              "b:" /* bucket */
                              "t:", /* Sleep time */
                              opts, NULL)) != -1) {
        switch (cmd) {
        case 's' :
            spool = optarg;
            break;
        case 'h' :
            host = optarg;
            break;
        case 'u' :
            user = optarg;
            break;
        case 'p' :
            passwd = optarg;
            break;
        case 'b' :
            bucket = optarg;
            break;
        case 't' :
            sleep_time = atoi(optarg);
            break;
        default:
            fprintf(stderr, "Usage: vacuum [options]\n"
                    "\t-h host\tHostname to connect to (default: localhost:8091)\n"
                    "\t-u user\tUsername to log in with (default: none)\n"
                    "\t-p passwd\tPassword to log in with (default: none)\n"
                    "\t-b name\tName of bucket to connect to (default: default)\n"
                    "\t-v\tEnable verbosity\n"
                    "\t-t sec\tNumber of seconds between each scan (default: 5)\n"
                    "\t-s dir\tLocation of spool directory (default: %s)\n",
                    default_spool);
            exit(EXIT_FAILURE);
        }
    }

    /* Change working directory to the spool directory */
    if (chdir(spool) != 0) {
        fprintf(stderr, "Failed to enter directory %s: %s\n", spool,
                strerror(errno));
        exit(EXIT_FAILURE);
    }

    memset(&create_options, 0, sizeof(create_options));
    create_options.v.v0.host = host;
    create_options.v.v0.user = user;
    create_options.v.v0.passwd = passwd;
    create_options.v.v0.bucket = bucket;

    /* Create the instance to lcb */
    ret = lcb_create(&instance, &create_options);
    if (ret != LCB_SUCCESS) {
        fprintf(stderr, "Failed to create couchbase instance\n");
        exit(EXIT_FAILURE);
    }

    /* Set up the callbacks we want */
    (void)lcb_set_store_callback(instance, store_callback);
    (void)lcb_set_error_callback(instance, error_callback);

    /* Tell libcouchback to connect to the server */
    ret = lcb_connect(instance);
    if (ret != LCB_SUCCESS) {
        fprintf(stderr, "Failed to connect: %s\n",
                lcb_strerror(instance, ret));
        exit(EXIT_FAILURE);
    }

    /* Wait for the server to complete */
    lcb_wait(instance);
    if ((ret = lcb_enable_timings(instance) != LCB_SUCCESS)) {
        fprintf(stderr, "Failed to enable timings: %s\n",
                lcb_strerror(instance, ret));
    }

    /* Loop forever and process the spool directory */
    while (1) {
        int ii;
        int nsec = sleep_time;
        process_directory();
        do {
            fprintf(stdout, "\rsleeping %d secs before retry..", nsec);
            fflush(stdout);
            sleep(1);
            --nsec;
        } while (nsec > 0);
        fprintf(stdout, "\r");
        for (ii = 0; ii < 70; ++ii) {
            fprintf(stdout, " ");
        }
        fprintf(stdout, "\r");
        fflush(stdout);
    }

    return 0;
}
Esempio n. 14
0
Menu::Menu(){
  inputsys = app->inputsys;
  drawsys = app->drawsys;
  indicator->init(">", 20, 0, 0);
  setup_options();
}
int
main (int argc, char **argv)
{
	GtkBuilder *builder;
	char       *uifile;
	GError     *error;

	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	error = NULL;
	if (!gtk_init_with_args (&argc, &argv,
				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
				 &error)) {
		if (error) {
			g_printerr ("%s\n", error->message);
			g_error_free (error);
		} else
			g_printerr ("Cannot initiliaze GTK+.\n");

		return 1;
	}

	if (!matecomponent_init (&argc, argv)) {
		g_printerr ("Cannot initialize matecomponent.\n");
		return 1;
	}

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		return 0;
	}

	builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

	uifile = MATE_PANEL_APPLET_BUILDERDIR "/panel-test-applets.ui";
	gtk_builder_add_from_file (builder, uifile, &error);

	if (error) {
		g_warning ("Error loading \"%s\": %s", uifile, error->message);
		g_error_free (error);
		return 1;
	}

	gtk_builder_connect_signals (builder, NULL);

	win             = GTK_WIDGET (gtk_builder_get_object (builder,
							      "toplevel"));
	applet_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "applet-combo"));
	prefs_dir_entry = GTK_WIDGET (gtk_builder_get_object (builder,
							      "prefs-dir-entry"));
	orient_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "orient-combo"));
	size_combo      = GTK_WIDGET (gtk_builder_get_object (builder,
							      "size-combo"));
	g_object_unref (builder);

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	return 0;
}
Esempio n. 16
0
int main(int argc, const char* argv[])
{
  /* Parse the cmd line */
  setup_options(argc, argv);

  BOOST_LOG_TRIVIAL(info) << "STARTUP";
  BOOST_LOG_TRIVIAL(info) << "CORE::GRAPH " << vm["graph"].as<std::string>();
  BOOST_LOG_TRIVIAL(info) << "CORE::ALGORITHM " << vm["benchmark"].as<std::string>();

  /* Read in key graph information */
  init_graph_desc(vm["graph"].as<std::string>());
  
  unsigned long blocked_memory = vm["blocked_memory"].as<unsigned long>();

  if(blocked_memory > 0) {
    BOOST_LOG_TRIVIAL(info) << clock::timestamp() 
			    << " Blocking memory amount " 
			    << blocked_memory;
    (void)map_anon_memory(blocked_memory, true, "Blockmem");
    BOOST_LOG_TRIVIAL(info) << clock::timestamp() 
			    << " Done blocking memory";
  }

  /* Only certain combinations of algorithms and formats
   * are supported. This is encoded below.
   * Algorithms that require the edge value cannot use format type2
   */
  if(false);
  ADD_SG_ALGORITHM(bfs, algorithm::sg_simple::bfs, 1, false);
  ADD_SG_ALGORITHM(bfs, algorithm::sg_simple::bfs, 2, false);
  ADD_SGASYNC_ALGORITHM(bfs_async, algorithm::sg_simple::bfs_async, 1, false);
  ADD_SGASYNC_ALGORITHM(bfs_async, algorithm::sg_simple::bfs_async, 2, false);
  ADD_SG_ALGORITHM(bfs_forest, algorithm::sg_simple::bfs_forest, 1, false);
  ADD_SG_ALGORITHM(bfs_forest, algorithm::sg_simple::bfs_forest, 2, false);
  ADD_SG_ALGORITHM(degree_cnt, algorithm::sg_simple::degree_cnt, 1, false);
  ADD_SG_ALGORITHM(degree_cnt, algorithm::sg_simple::degree_cnt, 2, false);
  ADD_SG_ALGORITHM(conductance, algorithm::sg_simple::conductance, 1, false);
  ADD_SG_ALGORITHM(conductance, algorithm::sg_simple::conductance, 2, false);
  ADD_SG_ALGORITHM(range_check, algorithm::sg_simple::range_check, 1, false);
  ADD_SG_ALGORITHM(range_check, algorithm::sg_simple::range_check, 2, false);
  ADD_ALGORITHM(reverse, algorithm::reverse::reverse, 1, false);
  ADD_ALGORITHM(reverse, algorithm::reverse::reverse, 2, false);
  ADD_SG_ALGORITHM(spmv, algorithm::sg_simple::spmv, 1, false);
  ADD_SG_ALGORITHM(sssp, algorithm::sg_simple::sssp, 1, false);
  ADD_SG_ALGORITHM(sssp_forest, algorithm::sg_simple::sssp_forest, 1, false);
  ADD_SG_ALGORITHM(cc, algorithm::sg_simple::cc, 1, false);
  ADD_SG_ALGORITHM(cc, algorithm::sg_simple::cc, 2, false);
  ADD_ALGORITHM(cc_online, algorithm::cc_online_ns::cc_online, 1, false);
  ADD_ALGORITHM(cc_online, algorithm::cc_online_ns::cc_online, 2, false);
  // Uncomment for ALS
  //ADD_SG_ALGORITHM(als, algorithm::sg_simple::als_factorization, 1, false);
  //ADD_SGASYNC_ALGORITHM(als_async, algorithm::sg_simple::als_async_factorization, 1, false);
  //
  ADD_SG_ALGORITHM(checkbip, algorithm::sg_simple::check_if_bipartite, 1, false);
  ADD_SG_ALGORITHM(mis, algorithm::sg_simple::mis, 1, false);
  ADD_SG_ALGORITHM(mis, algorithm::sg_simple::mis, 2, false);
  ADD_SG_ALGORITHM(pagerank, algorithm::sg_simple::pagerank, 1, false);
  ADD_SG_ALGORITHM(pagerank, algorithm::sg_simple::pagerank, 2, false);
  ADD_SG_ALGORITHM(pagerank_ddf, algorithm::sg_simple::pagerank_ddf, 1, false);
  ADD_SG_ALGORITHM(pagerank_ddf, algorithm::sg_simple::pagerank_ddf, 2, false);
  ADD_ALGORITHM(belief_propagation, algorithm::belief_prop::standard::belief_propagation, 1, false);
  ADD_ALGORITHM(belief_propagation_graphchi, algorithm::belief_prop::graphchi::belief_propagation_graphchi, 1, false);
  ADD_ALGORITHM(belief_propagation_graphchi, algorithm::belief_prop::graphchi::belief_propagation_graphchi, 2, false);
  ADD_ALGORITHM(mcst, algorithm::mcst::mcst, 1, false);
  ADD_SG_ALGORITHM(hyperanf, algorithm::sg_simple::hyperanf, 1, false);
  ADD_SG_ALGORITHM(hyperanf, algorithm::sg_simple::hyperanf, 2, false);
  ADD_ALGORITHM(scc, algorithm::scc::scc, 1, false);
  ADD_ALGORITHM(scc, algorithm::scc::scc, 2, false);
  ADD_ALGORITHM(triangle_counting, algorithm::triangle_counting::triangle_counting, 1, false);
  ADD_ALGORITHM(triangle_counting, algorithm::triangle_counting::triangle_counting, 2, false);
  ADD_ALGORITHM(bc, algorithm::bc::bc, 1, false);

  else {