Commit 97478063 authored by Matthieu Dorier's avatar Matthieu Dorier

made abt-snoozer optional

parent 8bdfc111
...@@ -72,8 +72,9 @@ LIBS="$ARGOBOTS_LIBS $LIBS" ...@@ -72,8 +72,9 @@ LIBS="$ARGOBOTS_LIBS $LIBS"
CPPFLAGS="$ARGOBOTS_CFLAGS $CPPFLAGS" CPPFLAGS="$ARGOBOTS_CFLAGS $CPPFLAGS"
CFLAGS="$ARGOBOTS_CFLAGS $CFLAGS" CFLAGS="$ARGOBOTS_CFLAGS $CFLAGS"
PKG_CHECK_MODULES([ABT_SNOOZER],[abt-snoozer],[], PKG_CHECK_MODULES([ABT_SNOOZER],[abt-snoozer],
[AC_MSG_ERROR([Could not find working abt-snoozer installation!])]) [AC_DEFINE([HAVE_ABT_SNOOZER], [1], [Use ABT-SNOOZER])],
[printf ""])
LIBS="$ABT_SNOOZER_LIBS $LIBS" LIBS="$ABT_SNOOZER_LIBS $LIBS"
CPPFLAGS="$ABT_SNOOZER_CFLAGS $CPPFLAGS" CPPFLAGS="$ABT_SNOOZER_CFLAGS $CPPFLAGS"
CFLAGS="$ABT_SNOOZER_CFLAGS $CFLAGS" CFLAGS="$ABT_SNOOZER_CFLAGS $CFLAGS"
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <abt.h> #include <abt.h>
#include <abt-snoozer.h>
#include <margo.h> #include <margo.h>
#include <margo-config.h>
#include "svc1-server.h" #include "svc1-server.h"
#include "svc2-server.h" #include "svc2-server.h"
...@@ -113,8 +112,15 @@ int main(int argc, char **argv) ...@@ -113,8 +112,15 @@ int main(int argc, char **argv)
assert(ret == 0); assert(ret == 0);
/* create a dedicated xstream and pool for another instance of svc1 */ /* create a dedicated xstream and pool for another instance of svc1 */
#ifdef HAVE_ABT_SNOOZER
ret = ABT_snoozer_xstream_create(1, &svc1_pool2, &svc1_xstream2); ret = ABT_snoozer_xstream_create(1, &svc1_pool2, &svc1_xstream2);
assert(ret == 0); assert(ret == 0);
#else
ret = ABT_xstream_create(ABT_SCHED_NULL, &svc1_xstream2);
assert(ret == 0);
ret = ABT_xstream_get_main_pools(svc1_xstream2, 1, &svc1_pool2);
assert(ret == 0);
#endif
/* register svc1, with mplex_id 2, to execute on a separate pool. This /* register svc1, with mplex_id 2, to execute on a separate pool. This
* will result in svc1 being registered twice, with the client being able * will result in svc1 being registered twice, with the client being able
* to dictate which instance they want to target * to dictate which instance they want to target
......
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <abt.h> #include <abt.h>
#include <margo-config.h>
#ifdef HAVE_ABT_SNOOZER
#include <abt-snoozer.h> #include <abt-snoozer.h>
#endif
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
...@@ -126,13 +130,22 @@ margo_instance_id margo_init(const char *addr_str, int mode, ...@@ -126,13 +130,22 @@ margo_instance_id margo_init(const char *addr_str, int mode,
if(ret != 0) goto err; if(ret != 0) goto err;
/* set caller (self) ES to idle without polling */ /* set caller (self) ES to idle without polling */
#ifdef HAVE_ABT_SNOOZER
ret = ABT_snoozer_xstream_self_set(); ret = ABT_snoozer_xstream_self_set();
if(ret != 0) goto err; if(ret != 0) goto err;
#endif
if (use_progress_thread) if (use_progress_thread)
{ {
#ifdef HAVE_ABT_SNOOZER
ret = ABT_snoozer_xstream_create(1, &progress_pool, &progress_xstream); ret = ABT_snoozer_xstream_create(1, &progress_pool, &progress_xstream);
if (ret != ABT_SUCCESS) goto err; if (ret != ABT_SUCCESS) goto err;
#else
ret = ABT_xstream_create(ABT_SCHED_NULL, &progress_xstream);
if (ret != ABT_SUCCESS) goto err;
ret = ABT_xstream_get_main_pools(progress_xstream, 1, &progress_pool);
if (ret != ABT_SUCCESS) goto err;
#endif
} }
else else
{ {
...@@ -146,11 +159,21 @@ margo_instance_id margo_init(const char *addr_str, int mode, ...@@ -146,11 +159,21 @@ margo_instance_id margo_init(const char *addr_str, int mode,
{ {
if (rpc_thread_count > 0) if (rpc_thread_count > 0)
{ {
rpc_xstreams = malloc(rpc_thread_count * sizeof(*rpc_xstreams)); rpc_xstreams = calloc(rpc_thread_count, sizeof(*rpc_xstreams));
if (rpc_xstreams == NULL) goto err; if (rpc_xstreams == NULL) goto err;
#ifdef HAVE_ABT_SNOOZER
ret = ABT_snoozer_xstream_create(rpc_thread_count, &rpc_pool, ret = ABT_snoozer_xstream_create(rpc_thread_count, &rpc_pool,
rpc_xstreams); rpc_xstreams);
if (ret != ABT_SUCCESS) goto err; if (ret != ABT_SUCCESS) goto err;
#else
int j;
ret = ABT_pool_create_basic(ABT_POOL_FIFO, ABT_POOL_ACCESS_MPMC, ABT_TRUE, &rpc_pool);
if (ret != ABT_SUCCESS) goto err;
for(j=0; j<rpc_thread_count; j++) {
ret = ABT_xstream_create(ABT_SCHED_NULL, rpc_xstreams+j);
if (ret != ABT_SUCCESS) goto err;
}
#endif
} }
else if (rpc_thread_count == 0) else if (rpc_thread_count == 0)
{ {
......
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