1
1

usnic: add v1.8/v1.10 compat code

Add compat code so that I can sync master against the v1.10 branch.
Этот коммит содержится в:
Jeff Squyres 2015-08-10 16:27:38 -07:00
родитель 7da1c4b875
Коммит 236cf7ff62
3 изменённых файлов: 90 добавлений и 1 удалений

Просмотреть файл

@ -148,6 +148,61 @@ int usnic_compat_free_list_init(opal_free_list_t *free_list,
mpool);
}
static volatile bool agent_thread_time_to_exit = false;
static opal_thread_t agent_thread;
static opal_event_base_t *agent_evbase = NULL;
/*
* Agent progress thread main entry point
*/
static void *agent_thread_main(opal_object_t *obj)
{
while (!agent_thread_time_to_exit) {
opal_event_loop(agent_evbase, OPAL_EVLOOP_ONCE);
}
return NULL;
}
opal_event_base_t *opal_progress_thread_init(const char *name)
{
assert(NULL == name);
/* Create the event base */
agent_evbase = opal_event_base_create();
if (NULL == agent_evbase) {
return NULL;
}
/* Spawn the agent thread event loop */
OBJ_CONSTRUCT(&agent_thread, opal_thread_t);
agent_thread.t_run = agent_thread_main;
agent_thread.t_arg = NULL;
int ret;
ret = opal_thread_start(&agent_thread);
if (OPAL_SUCCESS != ret) {
OPAL_ERROR_LOG(ret);
ABORT("Failed to start usNIC agent thread");
/* Will not return */
}
return agent_evbase;
}
int opal_progress_thread_finalize(const char *name)
{
assert(NULL == name);
agent_thread_time_to_exit = true;
/* break the event loop - this will cause the loop to exit upon
completion of any current event */
opal_event_base_loopbreak(agent_evbase);
opal_thread_join(&agent_thread, NULL);
return OPAL_SUCCESS;
}
#endif /* OMPI version */
/************************************************************************/

Просмотреть файл

@ -31,6 +31,9 @@
/* Free lists are unified into OPAL free lists */
# include "opal/class/opal_free_list.h"
/* Inclue the progress thread stuff */
# include "opal/runtime/opal_progress_threads.h"
# define USNIC_OUT opal_btl_base_framework.framework_output
/* JMS Really want to be able to get the job size somehow... But for
now, so that we can compile, just set it to a constant :-( */
@ -96,6 +99,8 @@ usnic_compat_proc_name_compare(opal_process_name_t a,
# define proc_bound() (ompi_rte_proc_is_bound)
# define opal_proc_local_get() ompi_proc_local()
# define opal_sync_event_base opal_event_base
# define opal_process_info orte_process_info
# define opal_proc_t ompi_proc_t
@ -185,6 +190,25 @@ usnic_compat_proc_name_compare(opal_process_name_t a,
return ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL, &a, &b);
}
/* Hotels in v1.8 */
# include "opal/class/opal_hotel.h"
/*
* Performance critical; needs to be inline
*/
static inline int
usnic_compat_opal_hotel_init(opal_hotel_t *hotel, int num_rooms,
opal_event_base_t *evbase,
uint32_t eviction_timeout,
int eviction_event_priority,
opal_hotel_eviction_callback_fn_t evict_callback_fn)
{
return opal_hotel_init(hotel, num_rooms, eviction_timeout,
eviction_event_priority, evict_callback_fn);
}
#define opal_hotel_init usnic_compat_opal_hotel_init
/*
* Replicate functions that exist on master
*/
@ -208,6 +232,17 @@ int usnic_compat_free_list_init(opal_free_list_t *free_list,
opal_free_list_item_init_fn_t item_init,
void *ctx);
/*
* Start the connectivity checker progress thread
*/
opal_event_base_t *opal_progress_thread_init(const char *name);
/*
* Stop the connectivity checker progress thread
*/
int opal_progress_thread_finalize(const char *name);
/************************************************************************/
#else

Просмотреть файл

@ -60,7 +60,6 @@
#include "opal/mca/memchecker/base/base.h"
#include "opal/util/show_help.h"
#include "opal/constants.h"
#include "opal/runtime/opal_progress_threads.h"
#if BTL_IN_OPAL
#include "opal/mca/btl/btl.h"