On Mar 23, 2011, at 6:12 AM, Hugo Meyer wrote:

> Hello @ll.
> 
> I need to store extra information into the orte_proc_t struct, i have added 
> into that struct another field with a default value, but now i need to update 
> that value with a value that i'm storint into the orte_process_info. My 
> question is how i can do this?
> 

You have an error in your code - you aren't pointing to a proc object at all. 
See below.

> I am actually doing this: 
> jdata = orte_get_job_data_object(proc.jobid);
> procs = (orte_proc_t**)jdata->procs->addr;

> procs_rec = (orte_proc_t**)procs[proc.vpid]->node->procs->addr;

Don't do the above - this is what is getting you into trouble. Instead, do this:

orte_proc_t *procptr1, *procptr2;
orte_node_t *node;

if (NULL == (procptr1 = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, 
proc.vpid))) {
> 

      ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
      return;  /* or whatever */
}
node = procptr1->node;

for (i=0; i < node->procs->size; i++) {
    if (NULL == (procptr2 = 
(orte_proc_t*)opal_pointer_array_get_item(node->procs, i))) {
> 

          ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
          return;  /* or whatever */
    }
     if (procptr2->name.jobid == procptr1->name.jobid &&
         procptr2->name.vpid == procptr1->name.vpid) {
             /* procptr2 now points at your proc struct, so set your value */
             procptr2->my_value = foo;
             break;
     }
}

Remember, the proc objects are -not- stored in vpid order in the node->procs 
array, so you have to search that array to find the one you want.


> ORTE_NAME_PRINT(&(procs_rec[x]->my_value));
> 


> But i don't know how to set my value, and where because i'm only getting now 
> my default initial value.
> 
> Thanks in advance.
> 
> Best Regards.
> 
> Hugo Meyer
> 
> 
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

Reply via email to