Пример #1
0
int main(int argc, char *argv[])
{
	int opt = 0;
	while ((opt = getopt(argc, argv, "h?")) != -1) {
		switch (opt) {
			case 'h':
				fprintf(stdout, "uts [# of children] [branching factor]\n");
				return 1;
			case '?':
			default:
				fprintf(stdout, "uts [# of children] [branching factor]\n");
				return 1;
		}
	}

	argc -= optind;
	argv += optind;

	int children = 0;
	int factor = 0;
	switch (argc) {
		case 0:
		case 1:
		default:
			fprintf(stderr, "\nMissing uts numbers.\n");
		case 2:
			children = atoi(argv[0]);
			factor = atoi(argv[1]);
			break;
	}
	//printf("%d %d\n", children, factor);
	parallel_uts( children, factor );

	return 0;
}
Пример #2
0
static int _uts_main_action(void *args, size_t size)
{
	Node *root = (Node *)args;
	Node temp;

	uts_initRoot(&temp, type);

	//mutex = hpx_lco_sema_new(1);
	bots_number_of_tasks = parallel_uts(&temp);

	uts_show_stats();
	uts_check_result();

	hpx_exit(HPX_SUCCESS);
}
Пример #3
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); }
		);
}