currently I'm working at the r2 component of the bml framework. When I
tried to get an deeper understanding of the component I experienced
difficulties to figure out how the add_proc function should behave. So
my question is how should the function behave, and what is the purpose
of the bml_endpoint array? An explanation of my difficulties follows.
The add_proc function is implemented in bml_r2.c and starts at line 164
> struct ompi_proc_t** procs,
> struct mca_bml_base_endpoint_t** bml_endpoints,
> struct ompi_bitmap_t* reachable
When I first read it, it seems that the function accepts an array of
ompi_proc_t structs and return an array of the same size which contains
one bml_endpoint for every process in the procs array.
At the beginning of the function (line 193 to 204) is a loop checking
if there are processes which are not new. If this is the case the
existing bml_endpoint is selected and stored in the endpoint array. New
processes are stored in an different array. This means if all processes
are known the function behaves like described above.
When there are new processes the procs array is overwritten with the
newly created array of new processes.(line 210) This array may be
shorter. (When there was at least one known process) So the number of
elements in nprocs is overwritten too. (line 211) But this nummber is
no pointer so the calling function couldn't notice it.
Now new bml_endpoints are created an stored in the bml_endpoints array.
But they are stored at the position the process has in the new
array!(line 271) So existing entries may be overwritten.
The function receives an array with 4 processes (process 0 to 3).
Process 2 is already known. So in the first loop the bml_endpoint of
process 2 is stored at bml_endpoints. Also a new array is created
containing process 0,1,3. This new array replaces the procs array. Then
for all three processes bml_endpoints are created and stored at
bml_endpoint[0,1,2]. So the existing entry (bml_endpoint) is
So the bml_endpoint array contains only three elements, but the calling
function has as number 4, because the new number can't be returned.
So my question again. Is this the intended behavior or is it a bug? How
should the function behave?