Update the job object pack-unpack fns
This commit was SVN r23392.
Этот коммит содержится в:
родитель
b4e64cfd1c
Коммит
4af771a681
@ -148,15 +148,28 @@ int orte_dt_pack_job(opal_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, opal_data_type_t type)
|
||||
{
|
||||
int rc;
|
||||
int32_t i, j, np;
|
||||
int32_t i, j;
|
||||
orte_job_t **jobs;
|
||||
orte_proc_t *proc;
|
||||
orte_app_context_t *app;
|
||||
|
||||
/* array of pointers to orte_job_t objects - need to pack the objects a set of fields at a time */
|
||||
jobs = (orte_job_t**) src;
|
||||
|
||||
for (i=0; i < num_vals; i++) {
|
||||
/* pack the name of this job - may be null */
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
|
||||
(void*)(&(jobs[i]->name)), 1, OPAL_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the name of the instance of the job - may be null */
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
|
||||
(void*)(&(jobs[i]->instance)), 1, OPAL_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the jobid */
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
|
||||
(void*)(&(jobs[i]->jobid)), 1, ORTE_JOBID))) {
|
||||
@ -205,41 +218,6 @@ int orte_dt_pack_job(opal_buffer_t *buffer, const void *src,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* pack the number of procs for the job */
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
|
||||
(void*)(&(jobs[i]->num_procs)), 1, ORTE_VPID))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* there might actually not be any procs in the array, so we
|
||||
* need to count them first
|
||||
*/
|
||||
np = 0;
|
||||
for (j=0; j < jobs[i]->procs->size; j++) {
|
||||
if (NULL != opal_pointer_array_get_item(jobs[i]->procs, j)) {
|
||||
np++;
|
||||
}
|
||||
}
|
||||
/* now pack that number */
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer, (void*)&np, 1, OPAL_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (0 < np) {
|
||||
for (j=0; j < jobs[i]->procs->size; j++) {
|
||||
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jobs[i]->procs, j))) {
|
||||
continue;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_pack_buffer(buffer,
|
||||
(void*)&proc, 1, ORTE_PROC))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if the map is NULL, then we cannot pack it as there is
|
||||
* nothing to pack. However, we have to flag whether or not
|
||||
* the map is included so the unpacking routine can know
|
||||
|
@ -151,9 +151,8 @@ int orte_dt_unpack_job(opal_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, opal_data_type_t type)
|
||||
{
|
||||
int rc;
|
||||
int32_t i, n, np, nprocs;
|
||||
int32_t i, n;
|
||||
orte_job_t **jobs;
|
||||
orte_proc_t *proc;
|
||||
orte_app_idx_t j;
|
||||
|
||||
/* unpack into array of orte_job_t objects */
|
||||
@ -167,6 +166,22 @@ int orte_dt_unpack_job(opal_buffer_t *buffer, void *dest,
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* unpack the name of this job - may be null */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer,
|
||||
&(jobs[i]->name), &n, OPAL_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the instance name of this job - may be null */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer,
|
||||
&(jobs[i]->instance), &n, OPAL_STRING))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the jobid */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer,
|
||||
@ -221,32 +236,6 @@ int orte_dt_unpack_job(opal_buffer_t *buffer, void *dest,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the number of procs */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer,
|
||||
(void*)(&(jobs[i]->num_procs)), &n, ORTE_VPID))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* unpack the actual number of proc entries in the message */
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer, (void*)&nprocs, &n, OPAL_INT32))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
if (0 < nprocs) {
|
||||
for (np=0; np < nprocs; np++) {
|
||||
n = 1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss_unpack_buffer(buffer,
|
||||
(void**)&proc, &n, ORTE_PROC))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
opal_pointer_array_set_item(jobs[i]->procs, proc->name.vpid, proc);
|
||||
}
|
||||
}
|
||||
|
||||
/* if the map is NULL, then we din't pack it as there was
|
||||
* nothing to pack. Instead, we packed a flag to indicate whether or not
|
||||
* the map is included */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user