⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpr_data_type_unpacking_fns.c

📁 MPI stands for the Message Passing Interface. Written by the MPI Forum (a large committee comprising
💻 C
📖 第 1 页 / 共 2 页
字号:
    OPAL_TRACE(4);    /* unpack into array of subscription objects */    subs = (orte_gpr_subscription_t**) dest;    for (i=0; i < *num_vals; i++) {        /* create the subscription object */        subs[i] = OBJ_NEW(orte_gpr_subscription_t);        if (NULL == subs[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the subscription name */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->name),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the subscription id */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->id),                    &max_n, ORTE_GPR_SUBSCRIPTION_ID))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the subscription action */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->action),                    &max_n, ORTE_GPR_NOTIFY_ACTION))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* get the number of values */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(subs[i]->cnt),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are values, allocate the required space for the value pointers */        if (0 < subs[i]->cnt) {            subs[i]->values = (orte_gpr_value_t**)malloc(subs[i]->cnt * sizeof(orte_gpr_value_t*));            if (NULL == subs[i]->values) {                ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);                return ORTE_ERR_OUT_OF_RESOURCE;            }            /* and unpack them */            if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, subs[i]->values,                        &(subs[i]->cnt), ORTE_GPR_VALUE))) {                ORTE_ERROR_LOG(rc);                return rc;            }        }        /* the pointer fields for cb_func and user_tag were NOT packed         * so ignore them here as well         */    }    return ORTE_SUCCESS;}/* * TRIGGER */int orte_gpr_base_unpack_trigger(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_trigger_t **trigs;    orte_std_cntr_t i, max_n=1;    OPAL_TRACE(4);    /* unpack into array of trigger objects */    trigs = (orte_gpr_trigger_t**) dest;    for (i=0; i < *num_vals; i++) {        /* create the trigger object */        trigs[i] = OBJ_NEW(orte_gpr_trigger_t);        if (NULL == trigs[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the trigger name */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->name),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the trigger id */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->id),                    &max_n, ORTE_GPR_TRIGGER_ID))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the trigger action */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->action),                    &max_n, ORTE_GPR_TRIGGER_ACTION))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* get the number of values */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(trigs[i]->cnt),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are values, allocate the required space for the value pointers */        if (0 < trigs[i]->cnt) {            trigs[i]->values = (orte_gpr_value_t**)malloc(trigs[i]->cnt * sizeof(orte_gpr_value_t*));            if (NULL == trigs[i]->values) {                ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);                return ORTE_ERR_OUT_OF_RESOURCE;            }            /* and unpack them */            if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, trigs[i]->values,                        &(trigs[i]->cnt), ORTE_GPR_VALUE))) {                ORTE_ERROR_LOG(rc);                return rc;            }        }    }    return ORTE_SUCCESS;}/* * NOTIFY DATA */int orte_gpr_base_unpack_notify_data(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_notify_data_t **data;    orte_gpr_value_t **values;    orte_std_cntr_t i, j, max_n=1;    OPAL_TRACE(4);    /* unpack into array of notify_data objects */    data = (orte_gpr_notify_data_t**) dest;    for (i=0; i < *num_vals; i++) {        /* create the data object */        data[i] = OBJ_NEW(orte_gpr_notify_data_t);        if (NULL == data[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the subscription name */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->target),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the subscription number */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->id),                    &max_n, ORTE_GPR_SUBSCRIPTION_ID))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the remove flag */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->remove),                    &max_n, ORTE_BOOL))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* get the number of values */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[i]->cnt),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are values, unpack them to the value array */        if (0 < data[i]->cnt) {            if (ORTE_SUCCESS != (rc = orte_pointer_array_set_size(data[i]->values, data[i]->cnt))) {                ORTE_ERROR_LOG(rc);                return rc;            }            values = (orte_gpr_value_t**)(data[i]->values)->addr;            for (j=0; j < data[i]->cnt; j++) {                max_n = 1;                if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(values[j]),                           &max_n, ORTE_GPR_VALUE))) {                    ORTE_ERROR_LOG(rc);                    return rc;                }            }        }    }    return ORTE_SUCCESS;}/* * NOTIFY MSG */int orte_gpr_base_unpack_notify_msg(orte_buffer_t *buffer, void *dest,                       orte_std_cntr_t *num_vals, orte_data_type_t type){    int rc;    orte_gpr_notify_message_t **msg;    orte_gpr_notify_data_t **data;    orte_std_cntr_t i, j, max_n=1;    OPAL_TRACE(4);    /* unpack into array of notify_data objects */    msg = (orte_gpr_notify_message_t**) dest;    for (i=0; i < *num_vals; i++) {        /* create the data object */        msg[i] = OBJ_NEW(orte_gpr_notify_message_t);        if (NULL == msg[i]) {            ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);            return ORTE_ERR_OUT_OF_RESOURCE;        }        /* unpack the message type */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->msg_type),                    &max_n, ORTE_GPR_NOTIFY_MSG_TYPE))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the trigger name */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->target),                    &max_n, ORTE_STRING))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the trigger number */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->id),                    &max_n, ORTE_GPR_TRIGGER_ID))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* unpack the remove flag */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->remove),                    &max_n, ORTE_BOOL))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* get the number of datagrams */        if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(msg[i]->cnt),                    &max_n, ORTE_STD_CNTR))) {            ORTE_ERROR_LOG(rc);            return rc;        }        /* if there are datagrams, unpack them to the data array */        if (0 < msg[i]->cnt) {            if (ORTE_SUCCESS != (rc = orte_pointer_array_set_size(msg[i]->data, msg[i]->cnt))) {                ORTE_ERROR_LOG(rc);                return rc;            }            data = (orte_gpr_notify_data_t**)(msg[i]->data)->addr;            for (j=0; j < msg[i]->cnt; j++) {                max_n = 1;                if (ORTE_SUCCESS != (rc = orte_dss_unpack_buffer(buffer, &(data[j]),                           &max_n, ORTE_GPR_NOTIFY_DATA))) {                    ORTE_ERROR_LOG(rc);                    return rc;                }            }        }    }    return ORTE_SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -