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;
}
Esempio n. 2
0
int main(int argc, char** argv) {
	Node root;
	const char *fn = argc > 1 ? argv[1] : "input/uts/test.input";
	uts_read_file(fn);

	std::stringstream ss;
	ss << "Unbalanced Tree Search (" << fn << ")";
	
	inncabs::run_all(
		[&](const std::launch l) {
			number_of_tasks = parallel_uts(l, &root);
			return number_of_tasks;
		},
		[&](unsigned long long nt) {
			return uts_check_result(nt);
		},
		ss.str(), 
		[&] { uts_initRoot(&root); }
		);
}