From d003cb5be71cf2128e9ac7f5d07db35f1726d8f9 Mon Sep 17 00:00:00 2001 From: Phil Carns Date: Sat, 20 May 2017 18:05:01 +0200 Subject: [PATCH] stub composed client lib path --- examples/composition/composed-benchmark.c | 2 ++ examples/composition/composed-client-lib.c | 40 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/examples/composition/composed-benchmark.c b/examples/composition/composed-benchmark.c index f13fdaf..31941f2 100644 --- a/examples/composition/composed-benchmark.c +++ b/examples/composition/composed-benchmark.c @@ -82,6 +82,7 @@ int main(int argc, char **argv) NULL); /* register service APIs */ data_xfer_register_client(mid); + composed_register_client(mid); /* find addr for server */ ret = margo_addr_lookup(mid, argv[1], &svr_addr); @@ -91,6 +92,7 @@ int main(int argc, char **argv) assert(buffer); data_xfer_read(mid, svr_addr, buffer, buffer_sz); + composed_read(mid, svr_addr, buffer, buffer_sz); /* send one rpc to server to shut it down */ /* create handle */ diff --git a/examples/composition/composed-client-lib.c b/examples/composition/composed-client-lib.c index 99bedae..bae7968 100644 --- a/examples/composition/composed-client-lib.c +++ b/examples/composition/composed-client-lib.c @@ -37,6 +37,46 @@ int data_xfer_register_client(margo_instance_id mid) return(0); } +void composed_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_size_t buffer_sz) +{ + hg_handle_t handle; + delegator_read_in_t in; + delegator_read_out_t out; + int ret; + const struct hg_info *hgi; + + /* create handle */ + ret = HG_Create(margo_get_context(mid), svr_addr, delegator_read_id, &handle); + assert(ret == 0); + + /* register buffer for rdma/bulk access by server */ + hgi = HG_Get_info(handle); + assert(hgi); + ret = HG_Bulk_create(hgi->hg_class, 1, &buffer, &buffer_sz, + HG_BULK_WRITE_ONLY, &in.bulk_handle); + assert(ret == 0); + +#if 0 + HG_Set_target_id(handle, mplex_id); +#endif + + /* Send rpc. Note that we are also transmitting the bulk handle in the + * input struct. It was set above. + */ + margo_forward(mid, handle, &in); + + /* decode response */ + ret = HG_Get_output(handle, &out); + assert(ret == 0); + + /* clean up resources consumed by this rpc */ + HG_Bulk_free(in.bulk_handle); + HG_Free_output(handle, &out); + HG_Destroy(handle); + + return; +} + void data_xfer_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_size_t buffer_sz) { hg_handle_t handle; -- 2.26.2