示例#1
0
void k8s::watch()
{
#ifdef HAS_CAPTURE
	if(m_net)
	{
		check_components();
		m_net->watch();
	}
#endif
}
示例#2
0
/*
 * This function is called at the initialization time of every
 * *intrinsic* MPI_Op (it is *not* used for user-defined MPI_Ops!).
 * It is used to select which op component(s) will be active for a
 * given MPI_Op.
 *
 * This selection logic is not for the weak.
 */
int ompi_op_base_op_select(ompi_op_t *op)
{
    int i, ret;
    opal_list_t *selectable;
    opal_list_item_t *item;
    ompi_op_base_module_t *module;

    /* Announce */
    opal_output_verbose(10, ompi_op_base_framework.framework_output,
                        "op:base:op_select: new op: %s",
                        op->o_name);

    /* Make a module for all the base functions so that other modules
       can RETAIN it (vs. having NULL for the base function modules,
       and forcing all other modules to check for NULL before calling
       RETAIN). */
    module = OBJ_NEW(ompi_op_base_module_t);

    /* Initialize all functions to point to the corresponding base
       functions.  Set the corresponding module pointers to NULL,
       indicating that these are base functions with no corresponding
       module. */
    memset(&op->o_func, 0, sizeof(op->o_func));
    memset(&op->o_3buff_intrinsic, 0, sizeof(op->o_3buff_intrinsic));
    for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
        op->o_func.intrinsic.fns[i] =
            ompi_op_base_functions[op->o_f_to_c_index][i];
        op->o_func.intrinsic.modules[i] = module;
        OBJ_RETAIN(module);
        op->o_3buff_intrinsic.fns[i] =
            ompi_op_base_3buff_functions[op->o_f_to_c_index][i];
        op->o_3buff_intrinsic.modules[i] = module;
        OBJ_RETAIN(module);
    }

    /* Offset the initial OBJ_NEW */
    OBJ_RELEASE(module);

    /* Check for any components that want to run.  It's not an error
       if there are none; we'll just use all the base functions in
       this case. */
    opal_output_verbose(10, ompi_op_base_framework.framework_output,
                        "op:base:op_select: Checking all available components");
    selectable = check_components(&ompi_op_base_framework.framework_components, op);

    /* Do the selection loop.  The selectable list is in priority
       order; lowest priority first. */
    for (item = opal_list_remove_first(selectable);
         NULL != item;
         item = opal_list_remove_first(selectable)) {
        avail_op_t *avail = (avail_op_t*) item;

        /* Enable the module */
        if (NULL != avail->ao_module->opm_enable) {
            ret = avail->ao_module->opm_enable(avail->ao_module, op);
            if (OMPI_SUCCESS != ret) {
                /* If the module fails to enable, just release it and move
                   on */
                OBJ_RELEASE(avail->ao_module);
                OBJ_RELEASE(avail);
                continue;
            }
        }

        /* Copy over the non-NULL pointers */
        for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
            /* 2-buffer variants */
            if (NULL != avail->ao_module->opm_fns[i]) {
	        OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
                op->o_func.intrinsic.fns[i] = avail->ao_module->opm_fns[i];
                op->o_func.intrinsic.modules[i] = avail->ao_module;
                OBJ_RETAIN(avail->ao_module);
            }

            /* 3-buffer variants */
            if (NULL != avail->ao_module->opm_3buff_fns[i]) {
	        OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
                op->o_3buff_intrinsic.fns[i] =
                    avail->ao_module->opm_3buff_fns[i];
                op->o_3buff_intrinsic.modules[i] = avail->ao_module;
                OBJ_RETAIN(avail->ao_module);
            }
        }

        /* release the original module reference and the list item */
        OBJ_RELEASE(avail->ao_module);
        OBJ_RELEASE(avail);
    }

    /* Done with the list from the check_components() call so release it. */
    OBJ_RELEASE(selectable);

    /* Sanity check: for intrinsic MPI_Ops, we should have exactly the
       same pointers non-NULL as the corresponding initial table row
       in ompi_op_base_functions / ompi_op_base_3buff_functions.  The
       values may be different, of course, but the pattern of
       NULL/non-NULL should be exactly the same. */
    for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
        if ((NULL == ompi_op_base_functions[op->o_f_to_c_index][i] &&
             NULL != op->o_func.intrinsic.fns[i]) ||
            (NULL != ompi_op_base_functions[op->o_f_to_c_index][i] &&
             NULL == op->o_func.intrinsic.fns[i])) {
            /* Oops -- we found a mismatch.  This shouldn't happen; so
               go release everything and return an error (yes, re-use
               the "i" index because we're going to return without
               completing the outter loop). */
            for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
	        OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
		op->o_func.intrinsic.modules[i] = NULL;
                op->o_func.intrinsic.fns[i] = NULL;
                return OMPI_ERR_NOT_FOUND;
            }
        }
    }

    return OMPI_SUCCESS;
}
示例#3
0
int mca_io_base_delete(char *filename, struct ompi_info_t *info)
{
    int err, num_names;
    char *names, **name_array;
    opal_list_t *selectable;
    opal_list_item_t *item;
    avail_io_t *avail, selected;

    /* Announce */

    opal_output_verbose(10, mca_io_base_output,
                        "io:base:delete: deleting file: %s", 
                        filename);
  
    /* See if a set of component was requested by the MCA parameter.
       Don't check for error. */

    names = NULL;
    mca_base_param_lookup_string(mca_io_base_param, &names);

    /* Compute the intersection of all of my available components with
       the components from all the other processes in this file */

    /* JMS CONTINUE HERE */

    /* See if there were any listed in the MCA parameter; parse them
       and check them all */

    err = OMPI_ERROR;
    if (NULL != names && 0 < strlen(names)) {
        name_array = opal_argv_split(names, ',');
        num_names = opal_argv_count(name_array);
        
        opal_output_verbose(10, mca_io_base_output, 
                            "io:base:delete: Checking specific modules: %s",
                            names);
        selectable = check_components(&mca_io_base_components_available, 
                                      filename, info, name_array, num_names);
        opal_argv_free(name_array);
    }

    /* Nope -- a specific [set of] component[s] was not requested.  Go
       check them all. */
  
    else {
        opal_output_verbose(10, mca_io_base_output, 
                            "io:base:delete: Checking all available modules");
        selectable = check_components(&mca_io_base_components_available, 
                                      filename, info, NULL, 0);
    }

    /* Upon return from the above, the modules list will contain the
       list of modules that returned (priority >= 0).  If we have no
       io modules available, it's an error */

    if (NULL == selectable) {
        /* There's no modules available.  Doh! */
        /* show_help */
        return OMPI_ERROR;
    }
    /* Do some kind of collective operation to find a module that
       everyone has available */
#if 1
    /* For the moment, just take the top module off the list */
    /* MSC actually take the buttom */
    item = opal_list_remove_last(selectable);
    avail = (avail_io_t *) item;
    selected = *avail;
    OBJ_RELEASE(avail);
#else
    /* JMS CONTINUE HERE */
#endif

    /* Everything left in the selectable list is therefore unwanted,
       and we call their unquery() method (because they all had
       query() invoked, but will never have init() invoked in this
       scope). */

    for (item = opal_list_remove_first(selectable); item != NULL;
         item = opal_list_remove_first(selectable)) {
        avail = (avail_io_t *) item;
        unquery(avail, filename, info);
        OBJ_RELEASE(item);
    }
    OBJ_RELEASE(selectable);

    /* Finally -- delete the file with the selected component */

    if (OMPI_SUCCESS != (err = delete_file(&selected, filename, info))) {
        return err;
    }

    /* Announce the winner */
  
    opal_output_verbose(10, mca_io_base_output,
                        "io:base:delete: Selected io component %s", 
                        selected.ai_component.v2_0_0.io_version.mca_component_name);
  
    return OMPI_SUCCESS;
}
/*
 * This function is called at the initialization time of every
 * file.  It is used to select which io component will be
 * active for a given file.
 */
int mca_io_base_file_select(ompi_file_t *file,
                            mca_base_component_t *preferred)
{
    int err;
    char *str;
    opal_list_t *selectable;
    opal_list_item_t *item;
    avail_io_t *avail, selected;

    /* Announce */

    opal_output_verbose(10, ompi_io_base_framework.framework_output,
                        "io:base:file_select: new file: %s",
                        file->f_filename);

    /* Initialize all the relevant pointers, since they're used as
       sentinel values */

    file->f_io_version = MCA_IO_BASE_V_NONE;
    file->f_io_selected_data = NULL;

    /* Compute the intersection of all of my available components with
       the components from all the other processes in this file */

    /* JMS CONTINUE HERE */

    /* See if a preferred component was provided.  If so, try to
       select it.  If we don't succeed, fall through and do a normal
       selection. */

    err = OMPI_ERROR;
    if (NULL != preferred) {
        str = &(preferred->mca_component_name[0]);

        opal_output_verbose(10, ompi_io_base_framework.framework_output,
                            "io:base:file_select: Checking preferred module: %s",
                            str);
        selectable = check_components(&ompi_io_base_framework.framework_components,
                                      file, &str, 1);

        /* If we didn't get a preferred module, then call again
           without a preferred module.  This makes the logic below
           dramatically simpler. */

        if (NULL == selectable) {
            return mca_io_base_file_select(file, NULL);
        }

        /* We only fall through here if we were able to select one of
           the preferred modules */
    }

    /* Nope -- a specific [set of] component[s] was not requested.  Go
       check them all. */

    else {
        opal_output_verbose(10, ompi_io_base_framework.framework_output,
                            "io:base:file_select: Checking all available modules");
        selectable = check_components(&ompi_io_base_framework.framework_components,
                                      file, NULL, 0);
    }

    /* Upon return from the above, the modules list will contain the
       list of modules that returned (priority >= 0).  If we have no
       io modules available, it's an error */

    if (NULL == selectable) {
        /* There's no modules available.  Doh! */
        /* show_help */
        return OMPI_ERROR;
    }

    /* Do some kind of collective operation to find a module that
       everyone has available */

#if 1
    /* For the moment, just take the top module off the list */
    /* MSC actually take the buttom */
    item = opal_list_remove_last(selectable);
    avail = (avail_io_t *) item;
    selected = *avail;
    OBJ_RELEASE(avail);
#else
    /* JMS CONTINUE HERE */
#endif

    /* Everything left in the selectable list is therefore unwanted,
       and we call their unquery() method (because they all had
       query() invoked, but will never have init() invoked in this
       scope). */

    for (item = opal_list_remove_first(selectable); item != NULL;
         item = opal_list_remove_first(selectable)) {
        avail = (avail_io_t *) item;
        unquery(avail, file);
        OBJ_RELEASE(item);
    }
    OBJ_RELEASE(selectable);

    /* Save the pointers of the selected module on the ompi_file_t */

    file->f_io_version = selected.ai_version;
    file->f_io_selected_component = selected.ai_component;
    file->f_io_selected_module = selected.ai_module;
    file->f_io_selected_data = selected.ai_module_data;

    if (!strcmp (selected.ai_component.v2_0_0.io_version.mca_component_name,
                 "ompio")) {
        int ret;

        opal_mutex_lock(&ompi_mpi_ompio_bootstrap_mutex);
        if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fs_base_framework, 0))) {
            opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);
            return err;
        }
        if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fcoll_base_framework, 0))) {
            opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);
            return err;
        }
        if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fbtl_base_framework, 0))) {
            opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);
            return err;
        }
        if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_sharedfp_base_framework, 0))) {
            opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);
            return err;
        }
        opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);

        if (OMPI_SUCCESS !=
            (ret = mca_fs_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
            return err;
        }
        if (OMPI_SUCCESS !=
            (ret = mca_fcoll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
            return err;
        }
        if (OMPI_SUCCESS !=
            (ret = mca_fbtl_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
            return err;
        }
        if (OMPI_SUCCESS !=
            (ret = mca_sharedfp_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
            return err;
        }

    }
    /* Finally -- intialize the selected module. */

    if (OMPI_SUCCESS != (err = module_init(file))) {
        return err;
    }

    /* Announce the winner */

    opal_output_verbose(10, ompi_io_base_framework.framework_output,
                        "io:base:file_select: Selected io module %s",
                        selected.ai_component.v2_0_0.io_version.mca_component_name);

    return OMPI_SUCCESS;
}
示例#5
0
int mca_io_base_delete(const char *filename, struct opal_info_t *info)
{
    int err;
    opal_list_t *selectable;
    opal_list_item_t *item;
    avail_io_t *avail, selected;

    /* Announce */

    opal_output_verbose(10, ompi_io_base_framework.framework_output,
                        "io:base:delete: deleting file: %s",
                        filename);

    /* See if a set of component was requested by the MCA parameter.
       Don't check for error. */

    /* Compute the intersection of all of my available components with
       the components from all the other processes in this file */

    /* JMS CONTINUE HERE */

    /* See if there were any listed in the MCA parameter; parse them
       and check them all */

    err = OMPI_ERROR;
    opal_output_verbose(10, ompi_io_base_framework.framework_output,
                        "io:base:delete: Checking all available modules");
    selectable = check_components(&ompi_io_base_framework.framework_components,
                                  filename, info, NULL, 0);

    /* Upon return from the above, the modules list will contain the
       list of modules that returned (priority >= 0).  If we have no
       io modules available, it's an error */

    if (NULL == selectable) {
        /* There's no modules available.  Doh! */
        /* show_help */
        return OMPI_ERROR;
    }
    /* Do some kind of collective operation to find a module that
       everyone has available */
#if 1
    /* For the moment, just take the top module off the list */
    /* MSC actually take the buttom */
    item = opal_list_remove_last(selectable);
    avail = (avail_io_t *) item;
    selected = *avail;
    OBJ_RELEASE(avail);
#else
    /* JMS CONTINUE HERE */
#endif

    /* Everything left in the selectable list is therefore unwanted,
       and we call their unquery() method (because they all had
       query() invoked, but will never have init() invoked in this
       scope). */

    for (item = opal_list_remove_first(selectable); item != NULL;
         item = opal_list_remove_first(selectable)) {
        avail = (avail_io_t *) item;
        unquery(avail, filename, info);
        OBJ_RELEASE(item);
    }
    OBJ_RELEASE(selectable);

    if (!strcmp (selected.ai_component.v2_0_0.io_version.mca_component_name,
                 "ompio")) {
        int ret;

        opal_mutex_lock(&ompi_mpi_ompio_bootstrap_mutex);
        if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fs_base_framework, 0))) {
            opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);
            return err;
        }
        opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex);

        if (OMPI_SUCCESS !=
            (ret = mca_fs_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
            return err;
        }
    }

    
    /* Finally -- delete the file with the selected component */
    if (OMPI_SUCCESS != (err = delete_file(&selected, filename, info))) {
        return err;
    }

    /* Announce the winner */

    opal_output_verbose(10, ompi_io_base_framework.framework_output,
                        "io:base:delete: Selected io component %s",
                        selected.ai_component.v2_0_0.io_version.mca_component_name);

    return OMPI_SUCCESS;
}