int main(int argc, char *argv[]) {
  // register the actions
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _main, _main_action, HPX_POINTER, HPX_SIZE_T);
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _set_value, action_set_value, HPX_POINTER, HPX_SIZE_T);
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _get_value, action_get_value, HPX_POINTER, HPX_SIZE_T);

  if (hpx_init(&argc, &argv)) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return 1;
  }

  int opt = 0;
  while ((opt = getopt(argc, argv, "h?")) != -1) {
    switch (opt) {
     case 'h':
      _usage(stdout);
      return 0;
     case '?':
     default:
      _usage(stderr);
      return -1;
    }
  }

  // run the main action
  int e = hpx_run(&_main, NULL, 0);
  hpx_finalize();
  return e;
}
int main(int argc, char *argv[]) {
  // Register the main action
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _main, _main_action, HPX_POINTER, HPX_SIZE_T);

  if (hpx_init(&argc, &argv)) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return 1;
  }

  int opt = 0;
  while ((opt = getopt(argc, argv, "h?")) != -1) {
    switch (opt) {
     case 'h':
      usage(stdout);
      return 0;
     case '?':
     default:
      usage(stderr);
      return -1;
    }
  }

  fprintf(stdout, "Starting the cost of GAS Allocation benchmark\n");


  // run the main action
  int e = hpx_run(&_main, NULL, 0);
  hpx_finalize();
  return e;
}
int main(int argc, char *argv[]) {
  int e = hpx_init(&argc, &argv);
  if (e) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return e;
  }

  int iters = 100;
  size_t size = 8;
  int opt = 0;
  while ((opt = getopt(argc, argv, "i:s:h?")) != -1) {
    switch (opt) {
     case 'i':
       iters = atoi(optarg);
       break;
     case 's':
       size = atoi(optarg);
       break;
     case 'h':
       _usage(stdout, EXIT_SUCCESS);
     default:
       _usage(stderr, EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  e = hpx_run(&_main, &iters, &size);
  assert(e == HPX_SUCCESS);
  hpx_finalize();
}
Exemple #4
0
int main(int argc, char **argv)
{
   char *osm_ifile = "/dev/stdin";
   //bx_node_t *index = NULL;
   struct dstats ds;
   hpx_ctrl_t *ctl;
   struct stat st;
   int w_mmap = 1;
   int fd = 0;

   (void) init_log("stderr", LOG_DEBUG);

   if (argc > 1)
      osm_ifile = argv[1];

   if ((osm_ifile != NULL) && ((fd = open(osm_ifile, O_RDONLY)) == -1))
      log_msg(LOG_ERR, "cannot open file %s: %s", osm_ifile, strerror(errno)),
         exit(EXIT_FAILURE);

   if (fstat(fd, &st) == -1)
      perror("stat"), exit(EXIT_FAILURE);

   if (w_mmap)
   {
      log_msg(LOG_INFO, "input file will be memory mapped with mmap()");
      st.st_size = -st.st_size;
   }
   if ((ctl = hpx_init(fd, st.st_size)) == NULL)
      perror("hpx_init_simple"), exit(EXIT_FAILURE);

   log_msg(LOG_INFO, "reading osm data (file size %ld kb, memory at %p)",
         (long) labs(st.st_size) / 1024, ctl->buf.buf);

 (void) read_osm_file(ctl, get_objtree(), NULL, &ds);

   log_debug("tree memory used: %ld kb", (long) bx_sizeof() / 1024);
   log_debug("onode memory used: %ld kb", (long) onode_mem() / 1024);

   log_msg(LOG_INFO, "creating reverse pointers from nodes to ways");
   traverse(*get_objtree(), 0, IDX_WAY, (tree_func_t) rev_index_way_nodes, &index_);
   log_msg(LOG_INFO, "creating reverse pointers from relation members to relations");
   traverse(*get_objtree(), 0, IDX_REL, (tree_func_t) rev_index_rel_nodes, &index_);

   main_smrenderd();
   (void) close(ctl->fd);
   hpx_free(ctl);

   log_debug("freeing main objects");
   traverse(*get_objtree(), 0, IDX_REL, free_objects, NULL);
   traverse(*get_objtree(), 0, IDX_WAY, free_objects, NULL);
   traverse(*get_objtree(), 0, IDX_NODE, free_objects, NULL);

   log_debug("freeing main object tree");
   bx_free_tree(*get_objtree());

   log_msg(LOG_INFO, "Thanks for using smrender!");
   return EXIT_SUCCESS;
}
int main(int argc, char *argv[]) {
  int e = hpx_init(&argc, &argv);
  if (e) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return e;
  }

  // run the main action
  e = hpx_run(&thread_create, &e, sizeof(e));
  hpx_finalize();
  return e;
}
int main(int argc, char *argv[])
{
	long bots_t_start;
	long bots_t_end;
	Node root; 
	char bots_arg_file[255];

	int e = hpx_init(&argc, &argv);
	if (e) {
		fprintf(stderr, "HPX: failed to initialize.\n");
		return e;
	}

	int opt = 0;
	while ((opt = getopt(argc, argv, "h?")) != -1) {
		switch (opt) {
			case 'h':
				printf("./hpx-5 [file]");
			case '?':
			default:
				printf("./hpx-5 [file]");
		}
	}

	argc -= optind;
	argv += optind;

	switch (argc) {
		case 0:
			fprintf(stderr, "Missing uts file.\n"); // fall through
		default:
			printf("./hpx-5 [file]");
		case 1:
			strcpy(bots_arg_file, argv[0]);
			break;
	}

	uts_read_file(bots_arg_file);


	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _uts, _uts_action,
			HPX_POINTER, HPX_SIZE_T);
	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _uts_main, _uts_main_action,
			HPX_POINTER, HPX_SIZE_T);

	int t = hpx_run(&_uts_main, &root, sizeof(root));
	hpx_finalize();
	return t;
}
int main(int argc, char *argv[]) 
{
	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _nqueens_main, _nqueens_main_action,
			HPX_POINTER, HPX_SIZE_T);
	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _nqueens, _nqueens_action,
			HPX_POINTER, HPX_SIZE_T);

	if (hpx_init(&argc, &argv) != 0) {
                fprintf(stderr, "HPX: failed to initialize.\n");
                return -1;
        }

	// parse the command line
	int opt = 0;
	while ((opt = getopt(argc, argv, "h?")) != -1) {
		switch (opt) {
			case 'h':
				_usage(stdout, EXIT_SUCCESS);
			case '?':
			default:
				_usage(stderr, EXIT_FAILURE);
		}
	}

	argc -= optind;
	argv += optind;

	int n = 0;
	switch (argc) {
		case 0:
			fprintf(stderr, "\nMissing nqueens number.\n"); // fall through
		default:
			_usage(stderr, EXIT_FAILURE);
		case 1:
			n = atoi(argv[0]);
			break;
	}
	if( n > MAX_SIZE) {
		printf("Max size is %d.\n", MAX_SIZE);
		n = MAX_SIZE;
	}

	// run the main action
	int e = hpx_run(&_nqueens_main, &n, sizeof(n));
        hpx_finalize();
        return e;

}
int main(int argc, char *argv[])
{
	char bots_arg_file[255]="./input/small.input";

	if (hpx_init(&argc, &argv) != 0) {
                fprintf(stderr, "HPX: failed to initialize.\n");
                return -1;
        }

	// parse the command line
	int opt = 0;
	while ((opt = getopt(argc, argv, "h?")) != -1) {
		switch (opt) {
			case 'h':
				_usage(stdout, EXIT_SUCCESS);
			case '?':
			default:
				_usage(stderr, EXIT_FAILURE);
		}
	}

	argc -= optind;
	argv += optind;

	int n = 0;
	switch (argc) {
		case 0:
			fprintf(stderr, "\nMissing health input.\n"); // fall through
		default:
			_usage(stderr, EXIT_FAILURE);
		case 1:
			strcpy(bots_arg_file, argv[0] );
			break;
	}

	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _health, _health_action,
			HPX_POINTER, HPX_SIZE_T);
	HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _health_main, _health_main_action,
			HPX_POINTER, HPX_SIZE_T);

	int t = hpx_run(&_health_main, &bots_arg_file, sizeof(bots_arg_file));
	hpx_finalize();
	return t;
}
int main(int argc, char *argv[]) {
  // register the cswitch action
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _cswitch_main, _cswitch_main_action,
                      HPX_POINTER, HPX_SIZE_T);

  int e = hpx_init(&argc, &argv);
  if (e) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return e;
  }

  // parse the command line
  int opt = 0;
  while ((opt = getopt(argc, argv, "h?")) != -1) {
    switch (opt) {
     case 'h':
       _usage(stdout, EXIT_SUCCESS);
     case '?':
     default:
       _usage(stderr, EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  int n = 100000;
  switch (argc) {
   case 0:
     break;
   default:
     _usage(stderr, EXIT_FAILURE);
   case 1:
     n = atoi(argv[0]);
     break;
  }

  // run the main action
  e = hpx_run(&_cswitch_main, &n, sizeof(n));
  hpx_finalize();
  return e;
}
/// The main function parses the command line, sets up the HPX runtime system,
/// and initiates the first HPX thread to perform seqspawn(n).
int main(int argc, char *argv[]) {

  // register the actions
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _nop, _nop_action, HPX_POINTER, HPX_SIZE_T);
  HPX_REGISTER_ACTION(HPX_DEFAULT, HPX_MARSHALLED, _main, _main_action, HPX_POINTER, HPX_SIZE_T);

  if (hpx_init(&argc, &argv)) {
    fprintf(stderr, "HPX: failed to initialize.\n");
    return -1;
  }

  int opt = 0;
  while ((opt = getopt(argc, argv, "h?")) != -1) {
    switch (opt) {
     case 'h':
       _usage(stdout, EXIT_SUCCESS);
     case '?':
     default:
       _usage(stderr, EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  int n = 0;
  switch (argc) {
   case 0:
     fprintf(stderr, "\nMissing spawn count.\n");
   default:
     _usage(stderr, EXIT_FAILURE);
   case 1:
     n = atoi(argv[0]);
     break;
  }

  // run the main action
  int e = hpx_run(&_main, &n, sizeof(n));
  hpx_finalize();
  return e;
}
int main(int argc, char **argv) {

  int e = hpx_init(&argc, &argv);
  if (e) {
    fprintf(stderr, "failed to initialize HPX.\n");
    return e;
  }

  int n = 100;
  int nsteps = 100;

  // parse the command line
  int opt = 0;
  while ((opt = getopt(argc, argv, "n:s:f:h?")) != -1) {
    switch (opt) {
      case 'n':
       n = atoi(optarg);
       break;
      case 's':
       nsteps = atoi(optarg);
       break;
      case 'f':
       fname = optarg;
       break;
      case 'h':
       _usage(stdout, EXIT_SUCCESS);
       break;
     case '?':
     default:
       _usage(stderr, EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  // run the main action
  e = hpx_run(&_jacobi_main, &n, &nsteps);
  hpx_finalize();
  return e;
}