Example #1
0
int MPI_T_init_thread (int required, int *provided)
{
    int rc = MPI_SUCCESS;

    mpit_lock ();

    do {
        if (0 != mpit_init_count++) {
            break;
        }

        /* call opal_init_util to intialize the MCA system */
        rc = opal_init_util (NULL, NULL);
        if (OPAL_SUCCESS != rc) {
            rc = MPI_ERR_OTHER;
            break;
        }

        /* register all parameters */
        rc = ompi_info_register_framework_params (NULL);
        if (OMPI_SUCCESS != rc) {
            rc = MPI_ERR_OTHER;
            break;
        }

        /* determine the thread level. TODO -- this might
           be wrong */
        ompi_mpi_thread_level (required, provided);
    } while (0);

    mpit_unlock ();

    return rc;
}
Example #2
0
int MPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle)
{
    int ret = MPI_SUCCESS;

    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    mpit_lock ();

    do {
        /* Check that this is a valid handle */
        if (MPI_T_PVAR_HANDLE_NULL == *handle ||
            MPI_T_PVAR_ALL_HANDLES == *handle) {
            /* As of MPI 3.0 MPI_T_PVAR_ALL_HANDLES is not a valid handle for
               MPI_T_pvar_handle_free */
            ret = MPI_T_ERR_INVALID_HANDLE;
            break;
        }

        ret = mca_base_pvar_handle_free (*handle);
        if (OPAL_SUCCESS != ret) {
            ret = MPI_ERR_UNKNOWN;
        }

        *handle = MPI_T_PVAR_HANDLE_NULL;
    } while (0);

    mpit_unlock ();

    return ret;
}
int MPI_T_category_changed(int *stamp)
{
    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    mpit_lock ();
    *stamp = mca_base_var_group_get_stamp ();
    mpit_unlock ();

    return MPI_SUCCESS;
}
Example #4
0
int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosity,
			MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc,
			int *desc_len, int *bind, int *scope)
{
    const mca_base_var_t *var;
    int rc = MPI_SUCCESS;

    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    mpit_lock ();

    do {
        rc = mca_base_var_get (cvar_index, &var);
        if (OPAL_SUCCESS != rc) {
            rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX :
                MPI_ERR_OTHER;
            break;
        }

        mpit_copy_string (name, name_len, var->mbv_full_name);
        mpit_copy_string (desc, desc_len, var->mbv_description);

        /* find the corresponding mpi type for an mca type */
        rc = ompit_var_type_to_datatype (var->mbv_type, datatype);
        if (OMPI_SUCCESS != rc) {
            break;
        }

        if (NULL != enumtype) {
            *enumtype = var->mbv_enumerator ? (MPI_T_enum) var->mbv_enumerator : MPI_T_ENUM_NULL;
        }

        if (NULL != scope) {
            *scope = var->mbv_scope;
        }

        /* XXX -- TODO -- All bindings are currently 0. Add support for variable binding. */
        if (NULL != bind) {
            *bind = var->mbv_bind;
        }

        if (NULL != verbosity) {
            *verbosity = var->mbv_info_lvl;
        }
    } while (0);

    mpit_unlock ();

    return rc;
}
int MPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle,
                             MPI_T_cvar_handle *handle, int *count)
{
    ompi_mpit_cvar_handle_t *new_handle;
    int rc = MPI_SUCCESS;;

    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    if (MPI_PARAM_CHECK && (NULL == handle || NULL == count)) {
        return MPI_ERR_ARG;
    }

    mpit_lock ();

    *handle = NULL;

    do {
        new_handle = (ompi_mpit_cvar_handle_t *) malloc (sizeof (ompi_mpit_cvar_handle_t));
        if (NULL == new_handle) {
            rc = MPI_T_ERR_MEMORY;
            break;
        }

        rc = mca_base_var_get(cvar_index, &new_handle->var);
        if (OPAL_SUCCESS != rc) {
            rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc) ? MPI_T_ERR_INVALID_INDEX:
                MPI_ERR_OTHER;
            free (new_handle);
            break;
        }

        new_handle->bound_object = obj_handle;

        if (MCA_BASE_VAR_TYPE_STRING == new_handle->var->mbv_type) {
            /* Arbitrary string limit. Is there a better way to do this? */
            *count = 2048;
        } else {
            /* MCA only supports a single integer at this time. Change me if
               this assumption changes. */
            *count = 1;
        }

        *handle = (MPI_T_cvar_handle) new_handle;
    } while (0);

    mpit_unlock ();

    return rc;
}
Example #6
0
int MPI_T_pvar_get_index (const char *name, int var_class, int *pvar_index)
{
    int ret;

    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    if (MPI_PARAM_CHECK && (NULL == pvar_index || NULL == name)) {
        return MPI_ERR_ARG;
    }

    mpit_lock ();
    ret = mca_base_pvar_find_by_name (name, var_class, pvar_index);
    mpit_unlock ();
    if (OPAL_SUCCESS != ret) {
        return MPI_T_ERR_INVALID_NAME;
    }

    return MPI_SUCCESS;
}
Example #7
0
int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name,
                        int *name_len)
{
    const char *tmp;
    int rc, count;

    if (!mpit_is_initialized ()) {
        return MPI_T_ERR_NOT_INITIALIZED;
    }

    mpit_lock ();

    do {
        rc = enumtype->get_count (enumtype, &count);
        if (OPAL_SUCCESS != rc) {
            rc = MPI_ERR_OTHER;
            break;
        }

        if (index >= count) {
            rc = MPI_T_ERR_INVALID_INDEX;
            break;
        }

        rc = enumtype->get_value(enumtype, index, value, &tmp);
        if (OPAL_SUCCESS != rc) {
            rc = MPI_ERR_OTHER;
            break;
        }

        mpit_copy_string(name, name_len, tmp);
    } while (0);

    mpit_unlock ();

    return rc;
}