diff --git a/configure.ac b/configure.ac index d24bc82632639dd6e3ca2ce8a4c514107cd4cb0a..927cd35cb2c6eb3b2f2299e1cea4e4afb6aad39f 100755 --- a/configure.ac +++ b/configure.ac @@ -72,8 +72,9 @@ LIBS="$ARGOBOTS_LIBS $LIBS" CPPFLAGS="$ARGOBOTS_CFLAGS $CPPFLAGS" CFLAGS="$ARGOBOTS_CFLAGS $CFLAGS" -PKG_CHECK_MODULES([ABT_SNOOZER],[abt-snoozer],[], - [AC_MSG_ERROR([Could not find working abt-snoozer installation!])]) +PKG_CHECK_MODULES([ABT_SNOOZER],[abt-snoozer], + [AC_DEFINE([HAVE_ABT_SNOOZER], [1], [Use ABT-SNOOZER])], + [printf ""]) LIBS="$ABT_SNOOZER_LIBS $LIBS" CPPFLAGS="$ABT_SNOOZER_CFLAGS $CPPFLAGS" CFLAGS="$ABT_SNOOZER_CFLAGS $CFLAGS" diff --git a/examples/multiplex/margo-example-mp-server.c b/examples/multiplex/margo-example-mp-server.c index c24107769403d6558e44ead47f17d2331394890a..8ded3bb00273cbaa73ca8928b266d89d21c5188f 100644 --- a/examples/multiplex/margo-example-mp-server.c +++ b/examples/multiplex/margo-example-mp-server.c @@ -8,9 +8,8 @@ #include #include #include -#include #include - +#include #include "svc1-server.h" #include "svc2-server.h" @@ -113,8 +112,15 @@ int main(int argc, char **argv) assert(ret == 0); /* 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); - 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 * will result in svc1 being registered twice, with the client being able * to dictate which instance they want to target diff --git a/src/margo.c b/src/margo.c index d9f1e16bb133603d50dbf23b50b3b6a0965ea918..0f733710833b2cb6b6295173766128db7abe0b10 100644 --- a/src/margo.c +++ b/src/margo.c @@ -9,7 +9,11 @@ #include #include #include + +#include +#ifdef HAVE_ABT_SNOOZER #include +#endif #include #include @@ -126,13 +130,22 @@ margo_instance_id margo_init(const char *addr_str, int mode, if(ret != 0) goto err; /* set caller (self) ES to idle without polling */ +#ifdef HAVE_ABT_SNOOZER ret = ABT_snoozer_xstream_self_set(); if(ret != 0) goto err; +#endif if (use_progress_thread) { +#ifdef HAVE_ABT_SNOOZER 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 { @@ -146,11 +159,21 @@ margo_instance_id margo_init(const char *addr_str, int mode, { 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; +#ifdef HAVE_ABT_SNOOZER ret = ABT_snoozer_xstream_create(rpc_thread_count, &rpc_pool, rpc_xstreams); 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