2 Replies Latest reply on Apr 21, 2011 3:33 AM by aprell

    Accessing MPB data structures in RCCE (gory mode)


      Suppose the following line of code:


      t_vcharp X = RCCE_malloc(sizeof(char));


      because of symmetric memory model of RCCE, upon executing that line by cores, data structure X will be created in MPB portion of all cores.

      Now suppose core i is going to access the data structure X of core j. Does the following could do the task?


      t_vcharp Y=RCCE_comm_buffer[j]+X; // which means the address of starting point of MPB portion of core j added to the address X in core j


      In other words, is now Y the address of data structure X on core j? Is X a relative address?

      If not, what is the (elegant) way to obtain this address?




        • 1. Re: Accessing MPB data structures in RCCE (gory mode)

          You are right on the fact that the addresses that RCCE_malloc returns are relative to the beginning of the assigned to each core's MPB space.


          For this reason, if you want to take the same object that resides on the MPB space of another core you need to do the following:


          t_vcharp Y=RCCE_comm_buffer[j] + X - RCCE_comm_buffer[RCCE_ue()];


          By doing  X - RCCE_comm_buffer[RCCE_ue()] you manage to get the address of X on the core 0 and by adding RCCE_comm_buffer[j] you get the address at the node j.

          A good example that uses this are the functions RCCE_put/RCCE_get

          • 2. Re: Accessing MPB data structures in RCCE (gory mode)

            Suppose core i allocates space for an integer (padded to 32 bytes):


            MPB_int *x = (MPB_int *)RCCE_malloc(sizeof(MPB_int));


            What you need to know to access x from another core j is the byte offset of x within i's MPB.


            If i calculates this offset


            int offset = (int)x - (int)RCCE_comm_buffer[i];


            and passes it on to j, j can get a pointer to x with


            MPB_int *x = RCCE_comm_buffer[i] + offset;


            This allows you to break with the symmetric name space model of RCCE.

            1 of 1 people found this helpful