예제 #1
0
static int run(void)
{
	int i, ret = 0;

	ret = ft_init_fabric();
	if (ret)
		return ret;

	ret = ft_exchange_keys(&remote);
	if (ret)
		goto out;

	if (!(opts.options & FT_OPT_SIZE)) {
		for (i = 0; i < TEST_CNT; i++) {
			if (!ft_use_size(i, opts.sizes_enabled))
				continue;
			opts.transfer_size = test_size[i].size;
			init_test(&opts, test_name, sizeof(test_name));
			ret = run_test();
			if (ret)
				goto out;
		}
	} else {
		init_test(&opts, test_name, sizeof(test_name));
		ret = run_test();
		if (ret)
			goto out;
	}

	ft_sync();
	ft_finalize();
out:
	return ret;
}
예제 #2
0
static int stream(void)
{
	int ret, i;

	ret = ft_sync();
	if (ret)
		return ret;

	ft_start();
	for (i = 0; i < opts.iterations; i++) {
		ret = opts.dst_addr ?
			ft_tx(ep, remote_fi_addr, opts.transfer_size, &tx_ctx) : ft_rx(ep, opts.transfer_size);
		if (ret)
			return ret;
	}
	ft_stop();

	if (opts.machr)
		show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, 1,
			     opts.argc, opts.argv);
	else
		show_perf(NULL, opts.transfer_size, opts.iterations, &start, &end, 1);

	return 0;
}
예제 #3
0
static int run_test(void)
{
	int ret, i;

	ret = ft_sync();
	if (ret)
		return ret;

	ft_start();
	for (i = 0; i < opts.iterations; i++) {
		ret = ft_rma(opts.rma_op, ep, opts.transfer_size, &remote, ep);
		if (ret)
			return ret;
	}
	ft_stop();

	if (opts.machr)
		show_perf_mr(opts.transfer_size, opts.iterations, &start, &end,
				1, opts.argc, opts.argv);
	else
		show_perf(NULL, opts.transfer_size, opts.iterations,
				&start, &end, 1);

	return 0;
}
예제 #4
0
int pingpong(void)
{
	int ret, i;

	ret = ft_sync();
	if (ret)
		return ret;

	ft_start();
	for (i = 0; i < opts.iterations; i++) {
		ret = opts.dst_addr ?
			ft_tx(opts.transfer_size) : ft_rx(opts.transfer_size);
		if (ret)
			return ret;

		ret = opts.dst_addr ?
			ft_rx(opts.transfer_size) : ft_tx(opts.transfer_size);
		if (ret)
			return ret;
	}
	ft_stop();

	if (opts.machr)
		show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, 2, opts.argc, opts.argv);
	else
		show_perf(test_name, opts.transfer_size, opts.iterations, &start, &end, 2);

	return 0;
}
예제 #5
0
static int send_recv()
{
	struct fi_cq_entry comp;
	int ret;

	ret = fi_recv(ep, rx_buf, rx_size + ft_rx_prefix_size(),
		      mr_desc, 0, &rx_ctx);
	if (ret)
		return ret;

	ft_sync();

	fprintf(stdout, "Posting a send...\n");
	ret = ft_post_tx(ep, remote_fi_addr, tx_size, NO_CQ_DATA, &tx_ctx);
	if (ret)
		return ret;

	while ((tx_cq_cntr < tx_seq) || (rx_cq_cntr < rx_seq)) {
		/* Wait for completion events on CQs */
		ret = fi_wait(waitset, -1);
		if (ret < 0) {
			FT_PRINTERR("fi_wait", ret);
			return ret;
		}

		/* Read the send completion entry */
		ret = fi_cq_read(txcq, &comp, 1);
		if (ret > 0) {
			tx_cq_cntr++;
			fprintf(stdout, "Received send completion event!\n");
		} else if (ret < 0 && ret != -FI_EAGAIN) {
			if (ret == -FI_EAVAIL) {
				ret = ft_cq_readerr(txcq);
			} else {
				FT_PRINTERR("fi_cq_read", ret);
			}
			return ret;
		}

		/* Read the recv completion entry */
		ret = fi_cq_read(rxcq, &comp, 1);
		if (ret > 0) {
			rx_cq_cntr++;
			fprintf(stdout, "Received recv completion event!\n");
		} else if (ret < 0 && ret != -FI_EAGAIN) {
			if (ret == -FI_EAVAIL) {
				ret = ft_cq_readerr(rxcq);
			} else {
				FT_PRINTERR("fi_cq_read", ret);
			}
			return ret;
		}
	}

	return 0;
}
예제 #6
0
int pingpong(void)
{
	int ret, i;

	ret = ft_sync();
	if (ret)
		return ret;

	if (opts.dst_addr) {
		for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
			if (i == opts.warmup_iterations)
				ft_start();

			if (opts.transfer_size < fi->tx_attr->inject_size)
				ret = ft_inject(opts.transfer_size);
			else
				ret = ft_tx(opts.transfer_size);
			if (ret)
				return ret;

			ret = ft_rx(opts.transfer_size);
			if (ret)
				return ret;
		}
	} else {
		for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
			if (i == opts.warmup_iterations)
				ft_start();

			ret = ft_rx(opts.transfer_size);
			if (ret)
				return ret;

			if (opts.transfer_size < fi->tx_attr->inject_size)
				ret = ft_inject(opts.transfer_size);
			else
				ret = ft_tx(opts.transfer_size);
			if (ret)
				return ret;
		}
	}
	ft_stop();

	if (opts.machr)
		show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, 2, opts.argc, opts.argv);
	else
		show_perf(NULL, opts.transfer_size, opts.iterations, &start, &end, 2);

	return 0;
}
예제 #7
0
static int run_test(void)
{
	int ret = 0;

	if (hints->ep_attr->type == FI_EP_MSG)
		ret = ft_init_fabric_cm();
	else
		ret = ft_init_fabric();
	if (ret)
		return ret;

	ret = overflow_test();

	ft_sync();
	ft_finalize();

	return ret;
}
예제 #8
0
static int run(void)
{
	int i, ret;

	if (!opts.dst_addr) {
		ret = ft_start_server();
		if (ret)
			return ret;
	}

	ret = opts.dst_addr ? ft_client_connect() : ft_server_connect();
	if (ret)
		return ret;

	ret = ft_exchange_keys(&remote);
	if (ret)
		return ret;

	if (!(opts.options & FT_OPT_SIZE)) {
		for (i = 0; i < TEST_CNT; i++) {
			if (!ft_use_size(i, opts.sizes_enabled))
				continue;
			opts.transfer_size = test_size[i].size;
			init_test(&opts, test_name, sizeof(test_name));
			ret = run_test();
			if (ret)
				goto out;
		}
	} else {
		init_test(&opts, test_name, sizeof(test_name));
		ret = run_test();
		if (ret)
			goto out;
	}

	ft_sync();
	ft_finalize();
out:
	fi_shutdown(ep, 0);
	return ret;
}
예제 #9
0
int bandwidth(void)
{
	int ret, i, j;

	ret = ft_sync();
	if (ret)
		return ret;

	/* The loop structured allows for the possibility that the sender
	 * immediately overruns the receiving side on the first transfer (or
	 * the entire window). This could result in exercising parts of the
	 * provider's implementation of FI_RM_ENABLED. For better or worse,
	 * some MPI-level benchmarks tend to use this type of loop for measuring
	 * bandwidth.  */

	if (opts.dst_addr) {
		for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
			if (i == opts.warmup_iterations)
				ft_start();

			for(j = 0; j < opts.window_size; j++) {
				if (opts.transfer_size < fi->tx_attr->inject_size)
					ret = ft_inject(opts.transfer_size);
				else
					ret = ft_post_tx(opts.transfer_size);
				if (ret)
					return ret;
			}
			ret = ft_get_tx_comp(tx_seq);
			if (ret)
				return ret;
			ret = ft_rx(4);
			if (ret)
				return ret;
		}
	} else {
		for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
			if (i == opts.warmup_iterations)
				ft_start();

			for(j = 0; j < opts.window_size; j++) {
				ret = ft_post_rx(opts.transfer_size);
				if (ret)
					return ret;
			}
			ret = ft_get_rx_comp(rx_seq-1); /* rx_seq is always one ahead */
			if (ret)
				return ret;
			ret = ft_tx(4);
			if (ret)
				return ret;
		}
	}
	ft_stop();

	if (opts.machr)
		show_perf_mr(opts.transfer_size, opts.iterations, &start, &end,
				opts.window_size, opts.argc, opts.argv);
	else
		show_perf(NULL, opts.transfer_size, opts.iterations, &start, &end,
				opts.window_size);

	return 0;
}
예제 #10
0
파일: av_xfer.c 프로젝트: ofiwg/libfabric
static int av_removal_test(void)
{
	int ret;

	fprintf(stdout, "AV address removal: ");
	hints = fi_dupinfo(base_hints);
	if (!hints)
		return -FI_ENOMEM;

	ret = ft_init_fabric();
	if (ret)
		goto out;

	if (opts.dst_addr) {
		ret = ft_tx(ep, remote_fi_addr, opts.transfer_size, &tx_ctx);
		if (ret) {
			FT_PRINTERR("ft_tx", -ret);
			goto out;
		}

		ret = fi_av_remove(av, &remote_fi_addr, 1, 0);
		if (ret) {
			FT_PRINTERR("fi_av_remove", ret);
			goto out;
		}

		ret = ft_sync();
		if (ret)
			goto out;

		ret = ft_init_av();
		if (ret) {
			FT_PRINTERR("ft_init_av", -ret);
			goto out;
		}

		ret = ft_rx(ep, opts.transfer_size);
		if (ret) {
			FT_PRINTERR("ft_rx", -ret);
			goto out;
		}
	} else {
		ret = ft_rx(ep, opts.transfer_size);
		if (ret) {
			FT_PRINTERR("ft_rx", -ret);
			goto out;
		}

		ret = fi_av_remove(av, &remote_fi_addr, 1, 0);
		if (ret) {
			FT_PRINTERR("fi_av_remove", ret);
			goto out;
		}

		ret = ft_sync();
		if (ret)
			goto out;

		ret = ft_init_av();
		if (ret) {
			FT_PRINTERR("ft_init_av", -ret);
			goto out;
		}

		ret = ft_tx(ep, remote_fi_addr, opts.transfer_size, &tx_ctx);
		if (ret) {
			FT_PRINTERR("ft_tx", -ret);
			goto out;
		}
	}

	fprintf(stdout, "PASS\n");
	(void) ft_sync();
out:
	ft_free_res();
	return ret;
}
예제 #11
0
static int run(void)
{
	int ret;

	ret = init_fabric();
	if (ret)
		return ret;

	ret = ft_init_av();
	if (ret)
		return ret;

	if (opts.dst_addr) {
		printf("Searching for a bad msg\n");
		ret = tagged_peek(0xbad);
		if (ret != -FI_ENOMSG) {
			FT_PRINTERR("FI_PEEK", ret);
			return ret;
		}

		printf("Synchronizing with sender..\n");
		ret = ft_sync();
		if (ret)
			return ret;

		printf("Searching for a good msg\n");
		ret = tagged_peek(0x900d);
		if (ret != 1) {
			FT_PRINTERR("FI_PEEK", ret);
			return ret;
		}

		printf("Receiving msg\n");
		ret = fi_trecv(ep, buf, rx_size, fi_mr_desc(mr), remote_fi_addr,
				0x900d, 0, &rx_ctx);
		if (ret) {
			FT_PRINTERR("fi_trecv", ret);
			return ret;
		}

		printf("Completing recv\n");
		ret = ft_get_rx_comp(++rx_seq);
		if (ret)
			return ret;

	} else {
		printf("Sending tagged message\n");
		ret = fi_tsend(ep, tx_buf, tx_size, fi_mr_desc(mr),
				remote_fi_addr, 0x900d, &tx_ctx);
		if (ret)
			return ret;

		printf("Synchronizing with receiver..\n");
		ret = ft_sync();
		if (ret)
			return ret;

		printf("Getting send completion\n");
		ret = ft_get_tx_comp(tx_seq + 1);
		if (ret)
			return ret;
	}

	ft_finalize();
	return 0;
}
예제 #12
0
static int run_test_loop(void)
{
	int ret = 0;
	uint64_t op_data = send_data ? opts.transfer_size : NO_CQ_DATA;
	uint64_t op_tag = 0x1234;
	char *op_buf;
	int i, j;

	for (i = 0; i < num_iters; i++) {
		for (j = 0; j < concurrent_msgs; j++) {
			op_buf = get_tx_buf(j);
			if (ft_check_opts(FT_OPT_VERIFY_DATA))
				ft_fill_buf(op_buf + ft_tx_prefix_size(),
					    opts.transfer_size);

			ret = ft_post_tx_buf(ep, remote_fi_addr,
					     opts.transfer_size,
					     op_data, &tx_ctx_arr[j],
					     op_buf, mr_desc, op_tag);
			if (ret) {
				printf("ERROR send_msg returned %d\n", ret);
				return ret;
			}
		}

		ret = ft_sync();
		if (ret)
			return ret;

		for (j = 0; j < concurrent_msgs; j++) {
			op_buf = get_rx_buf(j);
			ret = ft_post_rx_buf(ep, opts.transfer_size,
					     &rx_ctx_arr[j], op_buf,
					     mr_desc, op_tag);
			if (ret) {
				printf("ERROR recv_msg returned %d\n", ret);
				return ret;
			}
		}

		for (j = 0; j < concurrent_msgs; j++) {
			ret = wait_recvs();
			if (ret < 1)
				return ret;
		}

		if (ft_check_opts(FT_OPT_VERIFY_DATA)) {
			for (j = 0; j < concurrent_msgs; j++) {
				op_buf = get_rx_buf(j);
				if (ft_check_buf(op_buf + ft_rx_prefix_size(),
						 opts.transfer_size))
					return -FI_EOTHER;
			}
		}

		for (j = 0; j < concurrent_msgs; j++) {
			ret = ft_get_tx_comp(tx_seq);
			if (ret)
				return ret;
		}

		if (i % 100 == 0)
			printf("PID %d GOOD iter %d/%ld completed\n",
				getpid(), i, num_iters);
	}

	(void) ft_sync();
	printf("PID %d GOOD all done\n", getpid());
	return ret;
}