2 Replies Latest reply on Nov 24, 2010 2:51 AM by shbakram

    Global Variables in RCCE Programs


      How does rccerun treat global variables in a program? Each cores gets a copy of the variables. I recently wrote an app. usign a hybrid programming model (pthreads+RCCE) that uses global variables for communication among threads (within a single core). The results were rather unpredictable. I have NOT drawn any conclusions yet (if it is problem from my side) but just wondering if I am making some wrong assumptions. 

        • 1. Re: Global Variables in RCCE Programs

          I don't know exactly what you are referring to. ... but you can't use global variables to communicate among cores. Let me know if I interpreted your question incorrectly.


          By global do you mean something like the following?


             #include <string.h>

             #include <stdio.h>

             #include "RCCE.h"

               int glob001=1,glob002=2,glob003=3,glob004=4;

               int RCCE_APP(int argc, char **argv) {



          Here glob00x are global to the code running on a core, but they are not global with respect to other cores. Global variables are in a core's private memory, not shared memory. If you did the following



                if(iam==1) {

               printf("hello I am %d and globals are %d %d %d %d\n",


          then the glob00x variables are only changed on iam=1.


          rck01: hello I am 1 and globals are 4 6 7 8
          rck03: hello I am 3 and globals are 1 2 3 4
          rck00: hello I am 0 and globals are 1 2 3 4
          rck02: hello I am 2 and globals are 1 2 3 4

          • 2. Re: Global Variables in RCCE Programs

            Thanks. Question answered.