1
1
openmpi/opal/mca/common/ucx/common_ucx.c
Sergey Oblomov bef47b792c MCA/COMMON/UCX: unified logging across all UCX modules
- added common logging infrastructure for all
  UCX modules
- all UCX modules are switched to new infra

Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
2018-07-05 16:25:39 +03:00

77 строки
2.2 KiB
C

/*
* Copyright (C) Mellanox Technologies Ltd. 2018. ALL RIGHTS RESERVED.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "common_ucx.h"
#include "opal/mca/base/mca_base_var.h"
#include "opal/mca/pmix/pmix.h"
/***********************************************************************/
opal_common_ucx_module_t opal_common_ucx = {
.verbose = 0,
.progress_iterations = 100,
.registered = 0
};
OPAL_DECLSPEC void opal_common_ucx_mca_register(void)
{
opal_common_ucx.registered++;
if (opal_common_ucx.registered > 1) {
/* process once */
return;
}
mca_base_var_register("opal", "opal_common", "ucx", "verbose",
"Verbose level of the UCX components",
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
&opal_common_ucx.verbose);
mca_base_var_register("opal", "opal_common", "ucx", "progress_iterations",
"Set number of calls of internal UCX progress calls per opal_progress call",
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
&opal_common_ucx.progress_iterations);
opal_common_ucx.output = opal_output_open(NULL);
opal_output_set_verbosity(opal_common_ucx.output, opal_common_ucx.verbose);
}
OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void)
{
/* unregister only on last deregister */
opal_common_ucx.registered--;
assert(opal_common_ucx.registered >= 0);
if (opal_common_ucx.registered) {
return;
}
opal_output_close(opal_common_ucx.output);
}
void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status)
{
}
static void opal_common_ucx_mca_fence_complete_cb(int status, void *fenced)
{
*(int*)fenced = 1;
}
OPAL_DECLSPEC void opal_common_ucx_mca_pmix_fence(ucp_worker_h worker)
{
volatile int fenced = 0;
opal_pmix.fence_nb(NULL, 0, opal_common_ucx_mca_fence_complete_cb, (void*)&fenced);
while (!fenced) {
ucp_worker_progress(worker);
}
}