Commit acb8c296 authored by Matthieu Dorier's avatar Matthieu Dorier

Merge branch 'carns/dev-issue-44-init-opt' into 'master'

add margo_init_opt() variant to pass Mercury opts

Closes #44

See merge request !9
parents 9e12272a 4aea0007
...@@ -67,12 +67,43 @@ typedef ABT_eventual margo_request; ...@@ -67,12 +67,43 @@ typedef ABT_eventual margo_request;
* call margo_wait_for_finalize() after margo_init() to relinguish control to * call margo_wait_for_finalize() after margo_init() to relinguish control to
* Margo. * Margo.
*/ */
margo_instance_id margo_init( #define margo_init(_addr_str, _mode, _use_progress_thread, _rpc_thread_count)\
margo_init_opt(_addr_str, _mode, NULL, _use_progress_thread, _rpc_thread_count)
/**
* Initializes margo library with custom Mercury options.
* @param [in] addr_str Mercury host address with port number
* @param [in] mode Mode to run Margo in:
* - MARGO_CLIENT_MODE
* - MARGO_SERVER_MODE
* @param [in] hg_init_info (Optional) Hg init info, passed directly
* to Mercury
* @param [in] use_progress_thread Boolean flag to use a dedicated thread for
* running Mercury's progress loop. If false,
* it will run in the caller's thread context.
* @param [in] rpc_thread_count Number of threads to use for running RPC
* calls. A value of 0 directs Margo to execute
* RPCs in the caller's thread context.
* Clients (i.e processes that will *not*
* service incoming RPCs) should use a value
* of 0. A value of -1 directs Margo to use
* the same execution context as that used
* for Mercury progress.
* @returns margo instance id on success, MARGO_INSTANCE_NULL upon error
*
* NOTE: Servers (processes expecting to service incoming RPC requests) must
* specify non-zero values for use_progress_thread and rpc_thread_count *or*
* call margo_wait_for_finalize() after margo_init() to relinguish control to
* Margo.
*/
margo_instance_id margo_init_opt(
const char *addr_str, const char *addr_str,
int mode, int mode,
const struct hg_init_info *hg_init_info,
int use_progress_thread, int use_progress_thread,
int rpc_thread_count); int rpc_thread_count);
/** /**
* Initializes margo library from given argobots and Mercury instances. * Initializes margo library from given argobots and Mercury instances.
* @param [in] progress_pool Argobots pool to drive communication * @param [in] progress_pool Argobots pool to drive communication
......
...@@ -171,7 +171,7 @@ static hg_return_t margo_handle_cache_put(margo_instance_id mid, ...@@ -171,7 +171,7 @@ static hg_return_t margo_handle_cache_put(margo_instance_id mid,
static hg_id_t margo_register_internal(margo_instance_id mid, hg_id_t id, static hg_id_t margo_register_internal(margo_instance_id mid, hg_id_t id,
hg_proc_cb_t in_proc_cb, hg_proc_cb_t out_proc_cb, hg_rpc_cb_t rpc_cb, ABT_pool pool); hg_proc_cb_t in_proc_cb, hg_proc_cb_t out_proc_cb, hg_rpc_cb_t rpc_cb, ABT_pool pool);
margo_instance_id margo_init(const char *addr_str, int mode, margo_instance_id margo_init_opt(const char *addr_str, int mode, const struct hg_init_info *hg_init_info,
int use_progress_thread, int rpc_thread_count) int use_progress_thread, int rpc_thread_count)
{ {
ABT_xstream progress_xstream = ABT_XSTREAM_NULL; ABT_xstream progress_xstream = ABT_XSTREAM_NULL;
...@@ -268,7 +268,7 @@ margo_instance_id margo_init(const char *addr_str, int mode, ...@@ -268,7 +268,7 @@ margo_instance_id margo_init(const char *addr_str, int mode,
rpc_pool = progress_pool; rpc_pool = progress_pool;
} }
hg_class = HG_Init(addr_str, listen_flag); hg_class = HG_Init_opt(addr_str, listen_flag, hg_init_info);
if(!hg_class) goto err; if(!hg_class) goto err;
hg_context = HG_Context_create(hg_class); hg_context = HG_Context_create(hg_class);
......
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