Commit 17f8c22d authored by Philip Carns's avatar Philip Carns
Browse files

update to reflect HG API changes

- na_ and NA_ types and functions no longer necessary
parent 6be169d8
...@@ -24,8 +24,6 @@ struct run_my_rpc_args ...@@ -24,8 +24,6 @@ struct run_my_rpc_args
{ {
int val; int val;
margo_instance_id mid; margo_instance_id mid;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
}; };
...@@ -46,34 +44,17 @@ int main(int argc, char **argv) ...@@ -46,34 +44,17 @@ int main(int argc, char **argv)
margo_instance_id mid; margo_instance_id mid;
ABT_xstream progress_xstream; ABT_xstream progress_xstream;
ABT_pool progress_pool; ABT_pool progress_pool;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
na_addr_t svr_addr = NA_ADDR_NULL; hg_addr_t svr_addr = HG_ADDR_NULL;
hg_handle_t handle; hg_handle_t handle;
/* boilerplate HG initialization steps */ /* boilerplate HG initialization steps */
/***************************************/ /***************************************/
network_class = NA_Initialize("tcp://localhost:1234", NA_FALSE); hg_class = HG_Init("tcp://localhost:1234", HG_FALSE);
if(!network_class)
{
fprintf(stderr, "Error: NA_Initialize()\n");
return(-1);
}
na_context = NA_Context_create(network_class);
if(!na_context)
{
fprintf(stderr, "Error: NA_Context_create()\n");
NA_Finalize(network_class);
return(-1);
}
hg_class = HG_Init(network_class, na_context);
if(!hg_class) if(!hg_class)
{ {
fprintf(stderr, "Error: HG_Init()\n"); fprintf(stderr, "Error: HG_Init()\n");
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
hg_context = HG_Context_create(hg_class); hg_context = HG_Context_create(hg_class);
...@@ -81,8 +62,6 @@ int main(int argc, char **argv) ...@@ -81,8 +62,6 @@ int main(int argc, char **argv)
{ {
fprintf(stderr, "Error: HG_Context_create()\n"); fprintf(stderr, "Error: HG_Context_create()\n");
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
...@@ -146,8 +125,6 @@ int main(int argc, char **argv) ...@@ -146,8 +125,6 @@ int main(int argc, char **argv)
args[i].mid = mid; args[i].mid = mid;
args[i].hg_class = hg_class; args[i].hg_class = hg_class;
args[i].hg_context = hg_context; args[i].hg_context = hg_context;
args[i].na_context = na_context;
args[i].network_class = network_class;
/* Each fiber gets a pointer to an element of the array to use /* Each fiber gets a pointer to an element of the array to use
* as input for the run_my_rpc() function. * as input for the run_my_rpc() function.
...@@ -183,7 +160,7 @@ int main(int argc, char **argv) ...@@ -183,7 +160,7 @@ int main(int argc, char **argv)
/* send one rpc to server to shut it down */ /* send one rpc to server to shut it down */
/* find addr for server */ /* find addr for server */
ret = margo_na_addr_lookup(mid, network_class, na_context, "tcp://localhost:1234", &svr_addr); ret = margo_addr_lookup(mid, hg_context, "tcp://localhost:1234", &svr_addr);
assert(ret == 0); assert(ret == 0);
/* create handle */ /* create handle */
...@@ -202,8 +179,6 @@ int main(int argc, char **argv) ...@@ -202,8 +179,6 @@ int main(int argc, char **argv)
HG_Context_destroy(hg_context); HG_Context_destroy(hg_context);
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(0); return(0);
} }
...@@ -211,7 +186,7 @@ int main(int argc, char **argv) ...@@ -211,7 +186,7 @@ int main(int argc, char **argv)
static void run_my_rpc(void *_arg) static void run_my_rpc(void *_arg)
{ {
struct run_my_rpc_args *arg = _arg; struct run_my_rpc_args *arg = _arg;
na_addr_t svr_addr = NA_ADDR_NULL; hg_addr_t svr_addr = HG_ADDR_NULL;
hg_handle_t handle; hg_handle_t handle;
my_rpc_in_t in; my_rpc_in_t in;
my_rpc_out_t out; my_rpc_out_t out;
...@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg) ...@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg)
sprintf((char*)buffer, "Hello world!\n"); sprintf((char*)buffer, "Hello world!\n");
/* find addr for server */ /* find addr for server */
ret = margo_na_addr_lookup(arg->mid, arg->network_class, arg->na_context, "tcp://localhost:1234", &svr_addr); ret = margo_addr_lookup(arg->mid, arg->hg_context, "tcp://localhost:1234", &svr_addr);
assert(ret == 0); assert(ret == 0);
/* create handle */ /* create handle */
......
...@@ -24,8 +24,6 @@ struct run_my_rpc_args ...@@ -24,8 +24,6 @@ struct run_my_rpc_args
{ {
int val; int val;
margo_instance_id mid; margo_instance_id mid;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
}; };
...@@ -46,34 +44,17 @@ int main(int argc, char **argv) ...@@ -46,34 +44,17 @@ int main(int argc, char **argv)
margo_instance_id mid; margo_instance_id mid;
ABT_xstream progress_xstream; ABT_xstream progress_xstream;
ABT_pool progress_pool; ABT_pool progress_pool;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
na_addr_t svr_addr = NA_ADDR_NULL; hg_addr_t svr_addr = HG_ADDR_NULL;
hg_handle_t handle; hg_handle_t handle;
/* boilerplate HG initialization steps */ /* boilerplate HG initialization steps */
/***************************************/ /***************************************/
network_class = NA_Initialize("tcp://localhost:1234", NA_FALSE); hg_class = HG_Init("tcp://localhost:1234", HG_FALSE);
if(!network_class)
{
fprintf(stderr, "Error: NA_Initialize()\n");
return(-1);
}
na_context = NA_Context_create(network_class);
if(!na_context)
{
fprintf(stderr, "Error: NA_Context_create()\n");
NA_Finalize(network_class);
return(-1);
}
hg_class = HG_Init(network_class, na_context);
if(!hg_class) if(!hg_class)
{ {
fprintf(stderr, "Error: HG_Init()\n"); fprintf(stderr, "Error: HG_Init()\n");
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
hg_context = HG_Context_create(hg_class); hg_context = HG_Context_create(hg_class);
...@@ -81,8 +62,6 @@ int main(int argc, char **argv) ...@@ -81,8 +62,6 @@ int main(int argc, char **argv)
{ {
fprintf(stderr, "Error: HG_Context_create()\n"); fprintf(stderr, "Error: HG_Context_create()\n");
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
...@@ -146,8 +125,6 @@ int main(int argc, char **argv) ...@@ -146,8 +125,6 @@ int main(int argc, char **argv)
args[i].mid = mid; args[i].mid = mid;
args[i].hg_class = hg_class; args[i].hg_class = hg_class;
args[i].hg_context = hg_context; args[i].hg_context = hg_context;
args[i].na_context = na_context;
args[i].network_class = network_class;
/* Each fiber gets a pointer to an element of the array to use /* Each fiber gets a pointer to an element of the array to use
* as input for the run_my_rpc() function. * as input for the run_my_rpc() function.
...@@ -183,7 +160,7 @@ int main(int argc, char **argv) ...@@ -183,7 +160,7 @@ int main(int argc, char **argv)
/* send one rpc to server to shut it down */ /* send one rpc to server to shut it down */
/* find addr for server */ /* find addr for server */
ret = margo_na_addr_lookup(mid, network_class, na_context, "tcp://localhost:1234", &svr_addr); ret = margo_addr_lookup(mid, hg_context, "tcp://localhost:1234", &svr_addr);
assert(ret == 0); assert(ret == 0);
/* create handle */ /* create handle */
...@@ -202,8 +179,6 @@ int main(int argc, char **argv) ...@@ -202,8 +179,6 @@ int main(int argc, char **argv)
HG_Context_destroy(hg_context); HG_Context_destroy(hg_context);
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(0); return(0);
} }
...@@ -211,7 +186,7 @@ int main(int argc, char **argv) ...@@ -211,7 +186,7 @@ int main(int argc, char **argv)
static void run_my_rpc(void *_arg) static void run_my_rpc(void *_arg)
{ {
struct run_my_rpc_args *arg = _arg; struct run_my_rpc_args *arg = _arg;
na_addr_t svr_addr = NA_ADDR_NULL; hg_addr_t svr_addr = HG_ADDR_NULL;
hg_handle_t handle; hg_handle_t handle;
my_rpc_in_t in; my_rpc_in_t in;
my_rpc_out_t out; my_rpc_out_t out;
...@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg) ...@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg)
sprintf((char*)buffer, "Hello world!\n"); sprintf((char*)buffer, "Hello world!\n");
/* find addr for server */ /* find addr for server */
ret = margo_na_addr_lookup(arg->mid, arg->network_class, arg->na_context, "tcp://localhost:1234", &svr_addr); ret = margo_addr_lookup(arg->mid, arg->hg_context, "tcp://localhost:1234", &svr_addr);
assert(ret == 0); assert(ret == 0);
/* create handle */ /* create handle */
......
...@@ -27,8 +27,6 @@ int main(int argc, char **argv) ...@@ -27,8 +27,6 @@ int main(int argc, char **argv)
margo_instance_id mid; margo_instance_id mid;
ABT_xstream handler_xstream; ABT_xstream handler_xstream;
ABT_pool handler_pool; ABT_pool handler_pool;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
...@@ -40,25 +38,10 @@ int main(int argc, char **argv) ...@@ -40,25 +38,10 @@ int main(int argc, char **argv)
/* boilerplate HG initialization steps */ /* boilerplate HG initialization steps */
/***************************************/ /***************************************/
network_class = NA_Initialize("tcp://localhost:1234", NA_TRUE); hg_class = HG_Init("tcp://localhost:1234", HG_TRUE);
if(!network_class)
{
fprintf(stderr, "Error: NA_Initialize()\n");
return(-1);
}
na_context = NA_Context_create(network_class);
if(!na_context)
{
fprintf(stderr, "Error: NA_Context_create()\n");
NA_Finalize(network_class);
return(-1);
}
hg_class = HG_Init(network_class, na_context);
if(!hg_class) if(!hg_class)
{ {
fprintf(stderr, "Error: HG_Init()\n"); fprintf(stderr, "Error: HG_Init()\n");
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
hg_context = HG_Context_create(hg_class); hg_context = HG_Context_create(hg_class);
...@@ -66,8 +49,6 @@ int main(int argc, char **argv) ...@@ -66,8 +49,6 @@ int main(int argc, char **argv)
{ {
fprintf(stderr, "Error: HG_Context_create()\n"); fprintf(stderr, "Error: HG_Context_create()\n");
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
...@@ -143,8 +124,6 @@ int main(int argc, char **argv) ...@@ -143,8 +124,6 @@ int main(int argc, char **argv)
HG_Context_destroy(hg_context); HG_Context_destroy(hg_context);
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(0); return(0);
} }
......
...@@ -25,8 +25,6 @@ int main(int argc, char **argv) ...@@ -25,8 +25,6 @@ int main(int argc, char **argv)
ABT_pool handler_pool; ABT_pool handler_pool;
ABT_xstream progress_xstream; ABT_xstream progress_xstream;
ABT_pool progress_pool; ABT_pool progress_pool;
na_class_t *network_class;
na_context_t *na_context;
hg_context_t *hg_context; hg_context_t *hg_context;
hg_class_t *hg_class; hg_class_t *hg_class;
int single_pool_mode = 0; int single_pool_mode = 0;
...@@ -52,25 +50,10 @@ int main(int argc, char **argv) ...@@ -52,25 +50,10 @@ int main(int argc, char **argv)
/* boilerplate HG initialization steps */ /* boilerplate HG initialization steps */
/***************************************/ /***************************************/
network_class = NA_Initialize("tcp://localhost:1234", NA_TRUE); hg_class = HG_Init("tcp://localhost:1234", HG_TRUE);
if(!network_class)
{
fprintf(stderr, "Error: NA_Initialize()\n");
return(-1);
}
na_context = NA_Context_create(network_class);
if(!na_context)
{
fprintf(stderr, "Error: NA_Context_create()\n");
NA_Finalize(network_class);
return(-1);
}
hg_class = HG_Init(network_class, na_context);
if(!hg_class) if(!hg_class)
{ {
fprintf(stderr, "Error: HG_Init()\n"); fprintf(stderr, "Error: HG_Init()\n");
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
hg_context = HG_Context_create(hg_class); hg_context = HG_Context_create(hg_class);
...@@ -78,8 +61,6 @@ int main(int argc, char **argv) ...@@ -78,8 +61,6 @@ int main(int argc, char **argv)
{ {
fprintf(stderr, "Error: HG_Context_create()\n"); fprintf(stderr, "Error: HG_Context_create()\n");
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(-1); return(-1);
} }
...@@ -169,8 +150,6 @@ int main(int argc, char **argv) ...@@ -169,8 +150,6 @@ int main(int argc, char **argv)
HG_Context_destroy(hg_context); HG_Context_destroy(hg_context);
HG_Finalize(hg_class); HG_Finalize(hg_class);
NA_Context_destroy(network_class, na_context);
NA_Finalize(network_class);
return(0); return(0);
} }
......
...@@ -120,7 +120,7 @@ hg_return_t margo_bulk_transfer( ...@@ -120,7 +120,7 @@ hg_return_t margo_bulk_transfer(
margo_instance_id mid, margo_instance_id mid,
hg_context_t *context, hg_context_t *context,
hg_bulk_op_t op, hg_bulk_op_t op,
na_addr_t origin_addr, hg_addr_t origin_addr,
hg_bulk_t origin_handle, hg_bulk_t origin_handle,
size_t origin_offset, size_t origin_offset,
hg_bulk_t local_handle, hg_bulk_t local_handle,
...@@ -129,17 +129,15 @@ hg_return_t margo_bulk_transfer( ...@@ -129,17 +129,15 @@ hg_return_t margo_bulk_transfer(
/** /**
* address lookup * address lookup
* @param [in] na_class pointer to NA class
* @param [in] context pointer to context of execution * @param [in] context pointer to context of execution
* @param [in] name lookup name * @param [in] name lookup name
* @returns NA_SUCCESS on on success * @returns NA_SUCCESS on on success
*/ */
na_return_t margo_na_addr_lookup( hg_return_t margo_addr_lookup(
margo_instance_id mid, margo_instance_id mid,
na_class_t *na_class, hg_context_t *context,
na_context_t *context,
const char *name, const char *name,
na_addr_t *addr); hg_addr_t *addr);
/** /**
* Retrive the Margo instance that has been associated with a Mercury class * Retrive the Margo instance that has been associated with a Mercury class
......
...@@ -415,10 +415,10 @@ hg_return_t margo_respond( ...@@ -415,10 +415,10 @@ hg_return_t margo_respond(
} }
static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_cb_info) static hg_return_t margo_bulk_transfer_cb(const struct hg_cb_info *info)
{ {
hg_return_t hret = hg_bulk_cb_info->ret; hg_return_t hret = info->ret;
ABT_eventual *eventual = hg_bulk_cb_info->arg; ABT_eventual *eventual = info->arg;
/* propagate return code out through eventual */ /* propagate return code out through eventual */
ABT_eventual_set(*eventual, &hret, sizeof(hret)); ABT_eventual_set(*eventual, &hret, sizeof(hret));
...@@ -428,33 +428,32 @@ static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_ ...@@ -428,33 +428,32 @@ static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_
struct lookup_cb_evt struct lookup_cb_evt
{ {
na_return_t nret; hg_return_t nret;
na_addr_t addr; hg_addr_t addr;
}; };
static na_return_t margo_na_addr_lookup_cb(const struct na_cb_info *callback_info) static hg_return_t margo_addr_lookup_cb(const struct hg_cb_info *info)
{ {
struct lookup_cb_evt evt; struct lookup_cb_evt evt;
evt.nret = callback_info->ret; evt.nret = info->ret;
evt.addr = callback_info->info.lookup.addr; evt.addr = info->info.lookup.addr;
ABT_eventual *eventual = callback_info->arg; ABT_eventual *eventual = info->arg;
/* propagate return code out through eventual */ /* propagate return code out through eventual */
ABT_eventual_set(*eventual, &evt, sizeof(evt)); ABT_eventual_set(*eventual, &evt, sizeof(evt));
return(NA_SUCCESS); return(HG_SUCCESS);
} }
na_return_t margo_na_addr_lookup( hg_return_t margo_addr_lookup(
margo_instance_id mid, margo_instance_id mid,
na_class_t *na_class, hg_context_t *context,
na_context_t *context,
const char *name, const char *name,
na_addr_t *addr) hg_addr_t *addr)
{ {
na_return_t nret; hg_return_t nret;
struct lookup_cb_evt *evt; struct lookup_cb_evt *evt;
ABT_eventual eventual; ABT_eventual eventual;
int ret; int ret;
...@@ -465,8 +464,8 @@ na_return_t margo_na_addr_lookup( ...@@ -465,8 +464,8 @@ na_return_t margo_na_addr_lookup(
return(HG_NOMEM_ERROR); return(HG_NOMEM_ERROR);
} }
nret = NA_Addr_lookup(na_class, context, margo_na_addr_lookup_cb, nret = HG_Addr_lookup(context, margo_addr_lookup_cb,
&eventual, name, NA_OP_ID_IGNORE); &eventual, name, HG_OP_ID_IGNORE);
if(nret == 0) if(nret == 0)
{ {
ABT_eventual_wait(eventual, (void**)&evt); ABT_eventual_wait(eventual, (void**)&evt);
...@@ -483,7 +482,7 @@ hg_return_t margo_bulk_transfer( ...@@ -483,7 +482,7 @@ hg_return_t margo_bulk_transfer(
margo_instance_id mid, margo_instance_id mid,
hg_context_t *context, hg_context_t *context,
hg_bulk_op_t op, hg_bulk_op_t op,
na_addr_t origin_addr, hg_addr_t origin_addr,
hg_bulk_t origin_handle, hg_bulk_t origin_handle,
size_t origin_offset, size_t origin_offset,
hg_bulk_t local_handle, hg_bulk_t local_handle,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment