3 Replies Latest reply on Mar 23, 2011 6:37 AM by pkennedy

    Issue with static variables in RCCE apps


      I am trying to run few C++ apps on RCCE emulator. These apps contain significant amount of static variables. When I run these apps on RCCE emulator configuring for more than one cores, the static variable since it is global gets shared between the threads. This leads to erroneous execution.


      I see few static variables in the XHPL and NPB apps source code which is bundled with the RCCE software. Do these apps work only on the real SCC cores or do they work on emulator too? If it works on the emulator can someone explain how the static variables are insulated from each thread?


      - Karthik

        • 1. Re: Issue with static variables in RCCE apps

          We document this issue in the RCCE documentation.   OF course, this documentation si quite long so I am not surprised that you missed this.


          We used OpenMP to build the functional emmulator used with RCCE.   The emmulator does a good job of capturing the features of the chip, but there are excetions.   The biggest one is wtih static variables.   We do not try to do anything fancy to make them work.  IF you really want to use the emmulator with a program that has significant content in static variables, you will need to protect them by making them openmp trheadprivate variables. 


          HPL and the NAS parallel benchmarks work on the SCC chip.  We've run them in the emmulator before, but frankly now that we have real SCC silicon, we don't test them on the emmulator.  It is possible there has been some "version creep" and some issues may have leaked in that compromises functionality of the RCCE apps on the emmulator.



          • 2. Re: Issue with static variables in RCCE apps

            Thanks Tim for detailed explanation.


            Basically my application and the library it uses both have static variables. Hence I tried to use openmp threadprivate directive to the static variables and compiled using g++. But it seems that in gcc, threadprivate directive works for variables of Plain Old Datatypes(POD) (like int, float etc) and throws an error when applied to class variables/objects( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557). Since my application contains static variables which are class objects I could not use threadprivate in g++. I have read in some post that it works in icc. Does MARC community members have access to icc? Please let me know.

            • 3. Re: Issue with static variables in RCCE apps

              If you are using the data center, icc is already there for you.  If you have your own

              own MCPC/SCC, you can download icc here: http://marcbug.scc-dc.com/svn/repository/trunk/Compilers/


              However, the compiler won't run without a license. 


              Please request license keys from scc_support_usa@intel.com.


              Please provide your name, affiliation, email address, and the name of your Principal Investigator.


              icc 8.1 (the version the works on SCC) can compile non-POD class variables which appear in OpenMP threadprivate lists.  icc 8.1 supports the OpenMP* C++ version 2.0 API specification.  It can successfully compile the bugzilla case you pointed to here http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557


              Patrick Kennedy

              Intel Developer Support


              1 of 1 people found this helpful