10 Replies Latest reply on Jan 30, 2013 5:23 PM by Isuru Nawinne

    Baremetal applications - separate tasks for cores

    Isuru Nawinne

      Hi,

       

      I was experimenting with the Baremichael baremetal framework. Typical applications has the format..

       

      if (get_my_coreid() == 0){

        .....

      }

      else if(get_my_coreid() == 1){

      .....

      }

       

      I tried to eliminate this if blocking and have separate c programs for separate tasks, in the hope I can launch them on any core without having to edit and recompile the code every time. So I built the code and obtained two object files to be run on cores 00 and 01 (using sccMerge).

      When I load these two objects into the memory and release the resets, only the code on core 00 runs properly. Also the message passing between the two programs does not happen properly.

      Sometimes, the SCC hangs without running at all after releasing the resets and I have to re-initialize the SCC. I'm quite baffled as to what is the reason behind this. Does anyone have any similar experiences?

        • 1. Re: Baremetal applications - separate tasks for cores
          mwaughex

          Hi,
          Michael Ziwisky is the creator of Baremichael.  It is community supported.
          http://intelopenport.hosted.jivesoftware.com/message/138251#138251
          Micael Ziwisky does monitor the forum.  I believe you could also send him private message if no one else has an answer for you in the community.

          Regretfully, I am not familiar with baremicael. 
          -augie

          • 2. Re: Baremetal applications - separate tasks for cores
            Isuru Nawinne

            Thanks augie. I sent a PM to Michael regarding this.

            • 3. Re: Baremetal applications - separate tasks for cores
              mziwisky

              Hi Isuru,

               

              First, my thesis work on the SCC has concluded, and I no longer actively monitor these forums.  However, I do still read PMs and posts on threads to which I've posted/subscribed, so the PM was a good idea and I'll continue further communications on this thread.

               

              To address your issue -- one suggestion I could make is to check out the work by Johannes Scheller and Eric Noulard of ONERA, which is mentioned at http://communities.intel.com/message/159066#159066 and hosted at http://marcbug.scc-dc.com/svn/repository/trunk/baremetal/baremichael/ONERAtarballs/.  They provide a solution to loading and executing a different image per core within the BareMichael framework.  Their solution is based on a CMake environment.  I have not had hands-on experience with their framework, so I cannot offer assistance if you choose to use it.

               

              If you wish to stick with the "stock" BareMichael framework, I'll see if I can help.  First off, regarding execution of different tasks on different cores, if you could share a minimal example of your code and details of the steps you take (i.e. commands you're executing on the MCPC) that exhibit the problem, I'll take a look at it and try to see where you went astray.  Please also state which version of sccKit you're using, and which version of BareMichael.

               

              Regarding the failed message passing -- what method are you using to pass messages?  The RCCE library?  If so, which version of RCCE?  And are you able to get the included "RCCE_pingpong" example to work with BareMichael?

               

              Regards,

              Mike

              • 4. Re: Baremetal applications - separate tasks for cores
                Isuru Nawinne

                Thanks for the reply Michael. I'm using RCCE v2.0 for message passing.  I managed to get the included pingpong example running successfully. I tried out other RCCE functions also, with some success. The problem happens when I try to separate out the programs, build and load them separately.

                 

                I got a feeling that the issue might be something to do with the built LUT entries and/or memory object files. I'm afraid my understanding on LUT configurations are minimal

                 

                I've attached a simple program that's I've been trying to run. It's a simple producer-consumer scenario using RCCE_send and RCCE_recv. I changed the section in the make file where the MT File is created, to have an entry for one core (to avoid creating memory images for all the cores).

                 

                i.e. for the producer, the make file has..

                $(MT_FILE):

                  @echo "# pid mch-route mch-dest-id mch-offset-base testcase" > $(MT_FILE)

                  @echo "0x00 0x00 6 0x00 $(PWD)/$(OBJ_FILE)" >> $(MT_FILE)

                 

                and for the consumer..

                $(MT_FILE):

                  @echo "# pid mch-route mch-dest-id mch-offset-base testcase" > $(MT_FILE)

                  @echo "0x01 0x00 6 0x01 $(PWD)/$(OBJ_FILE)" >> $(MT_FILE)

                 

                Thanks again !

                • 5. Re: Baremetal applications - separate tasks for cores
                  mziwisky

                  I think you're right that the issue is with the LUT configuration and memory object files.

                   

                  I assume you've got two separate copies of the baremichael directory, which I'll refer to as bmP and bmC.  Both copies are identical except that bmP links and executes the producer.c routine and has the Makefile $(MT_FILE) target:

                  $(MT_FILE):

                    @echo "# pid mch-route mch-dest-id mch-offset-base testcase" > $(MT_FILE)

                    @echo "0x00 0x00 6 0x00 $(PWD)/$(OBJ_FILE)" >> $(MT_FILE)

                   

                   

                  while bmC links and executes the consumer.c routine and has the Makefile $(MT_FILE) target:

                  $(MT_FILE):

                    @echo "# pid mch-route mch-dest-id mch-offset-base testcase" > $(MT_FILE)

                    @echo "0x00 0x00 6 0x01 $(PWD)/$(OBJ_FILE)" >> $(MT_FILE)

                   

                  So you go to bmP/compile and run 'make,' then you go to bmC/compile and run 'make,' then you run 'make run.'  I'm just assuming this is what you're doing, and if so, here's the problem -- the default 'make' target is the "obj/" directory, which contains the images to load into RAM and LUT configurations for all tiles.  The "obj/" directory itself is like an image for the whole SCC system.  You're ending up with two different images for the SCC, one of which says "load the producer image onto core 0 and nothing onto any of the other cores," and the other which says "load the consumer image onto core 1 and nothing onto any of the other cores."  What you really want is a single SCC system image that says "load the producer image onto core 0, the consumer image onto core 1, and nothing onto any of the other cores."  Try this:

                   

                  After running 'make' in both bmP/compile and bmC/compile, the "core image" (i.e., the "producer image" or the "consumer image") is produced as bm*/battle.obj.  Create a file called battle.mt with the following contents:

                   

                  0x00 0x00 6 0x00 <full path to bmP>/compile/battle.obj

                  0x01 0x00 6 0x01 <full path to bmC>/compile/battle.obj

                   

                  Obviously, replace <full path to bm*> with the appropriate paths.

                  Then, run 'sccMerge -m 8 -n 12 -noimage battle.mt'

                  This should create an "obj/" directory with the system image that loads the cores with different core images.  Then do 'sccBoot -g obj/' and 'sccReset -r 0 1' to load and boot the images.

                   

                  Hopefully this helps even if my assumptions about what you're trying right now are wrong.  Let me know how it goes.

                   

                  --Mike

                  • 6. Re: Baremetal applications - separate tasks for cores
                    Isuru Nawinne

                    What you assumed are correct, I have separated directories for producer and consumer. I managed to get things working properly by following your advice Now I'm building my project in two levels. One to build the battle.obj for each part of the application. And another (top level) to merge the objects as you mentioned.

                     

                    Thank you very much for the help Michael. Really appreciate it !

                     

                    Cheers

                    -

                    Isuru

                    • 7. Re: Baremetal applications - separate tasks for cores
                      mziwisky

                      Glad to help

                       

                      For the record, the ONERA contributions I've mentioned above are essentially a framework for automating this process of loading different cores with different images.  You may find it useful, either directly or as inspiration.  (In addition, ONERA included some nice performance monitoring features and their own RCCE-like message passing library.)

                       

                      Take care,

                      Mike

                      • 8. Re: Baremetal applications - separate tasks for cores
                        Isuru Nawinne

                        Hello Mike,

                         

                        An additional question here. Does Baremichael support RCCE power management functions? I get "undefined reference" errors when compiling with power API functions. Glad if you could throw some light on the matter.

                         

                        Cheers,

                        -

                        Isuru

                        • 9. Re: Baremetal applications - separate tasks for cores
                          mziwisky

                          Hi Isuru,

                           

                          I've never tested the RCCE power management API with BareMichael, however it looks like it will compile.  Follow the README in RCCE_V2.0 to build the lib with power management (i.e., run './configure SCC_BAREMETAL ADD_POWER_API; ./makeall'), then in <baremichael>/compile/Makefile, set the LIB_RCCE variable to point to that library.  As it stands, I try to set LIB_RCCE appropriately based on the settings at the top of the Makefile of the variables RCCE_GORY, RCCE_SMALLFLAGS, and RCCE_PATH, but I don't consider the power API, so you can set LIB_RCCE manually instead.

                           

                          That should at least get you to compile, I think -- I haven't actually looked at the power API source, so no promises that things will work!  If you have any more troubles, let me know.  And please let me know if you're successful too -- if so I'd love to hear about it, and If not I may spend some time to build in support for the power management API.

                           

                          Regards,

                          Mike

                          1 of 1 people found this helpful
                          • 10. Re: Baremetal applications - separate tasks for cores
                            Isuru Nawinne

                            Like you said, power management wasn't considered in the original makefile. Only the gory/non-gory and bit-flags/word-flags choices were considered when linking the corresponding libRCCE. So the LIB_RCCE variable was set as..

                             

                            "LIB_RCCE = $(RCCE_PATH)/bin/SCC_BAREMETAL/libRCCE_smallflags_nongory_nopwrmgmt.a"

                            or

                            "LIB_RCCE = $(RCCE_PATH)/bin/SCC_BAREMETAL/libRCCE_bigflags_nongory_nopwrmgmt.a"

                            etc.. depending on the choice.


                            So, I set the LIB_RCCE manually to point to a libRCCE file with power management features..


                            "LIB_RCCE = $(RCCE_PATH)/bin/SCC_BAREMETAL/libRCCE_bigflags_nongory_pwrmgmt.a"

                             

                            And it worked! Now I can use the power management functions of RCCE on baremetal. Thank you very much for the help Mike. Appreciate it a lot!

                             

                            Cheers,

                            Isuru