Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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();
}
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;
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 9
0
/// 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;
}
Exemplo n.º 10
0
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;
}