1 2 Previous Next 18 Replies Latest reply on Nov 17, 2011 5:38 PM by tedk

    problem compileing RCCE emulator with pwrmgmt=1

    smeraji

      Hi,

       

      I tried to compile RCCE with pwrmgmfeatures and I received following errors. any Idea?

       

      ./configure emulator

      ./makeall

      ./make OMP_EMULATOR=1 PWRMGMT=1

       

      /root/RCCE_v1.1.0/src/RCCE_power_management.c:177:8: warning: extra tokens at end of #endif directive
      /root/RCCE_v1.1.0/src/RCCE_power_management.c: In function ‘long long int RC_global_clock()’:
      /root/RCCE_v1.1.0/src/RCCE_power_management.c:415:17: error: ‘_rdtsc’ was not declared in this scope
      /root/RCCE_v1.1.0/src/RCCE_power_management.c: In function ‘int RCCE_init_RPC(int*, int, int)’:
      /root/RCCE_v1.1.0/src/RCCE_power_management.c:457:29: error: ‘_rdtsc’ was not declared in this scope
      make: *** [RCCE_power_management.o] Error 1

        • 1. Re: problem compileing RCCE emulator with pwrmgmt=1
          aprell

          Did you try to compile the emulator with g++? Can you try it with gcc? Just change the compiler settings in common/symbols.in.

           

          Also, I think you need to add ADD_POWER_API to the configure line.

          • 2. Re: problem compileing RCCE emulator with pwrmgmt=1
            smeraji

            Thanks, I just succesully compiled it with gcc. I will try to use power libraries later today

            • 3. Re: problem compileing RCCE emulator with pwrmgmt=1
              aprell

              Hmm, thought so. I'll try to figure out why it's not working with g++...

              • 4. Re: problem compileing RCCE emulator with pwrmgmt=1
                aprell

                Have you figured it out? What you can do manually until RCCE is patched is move the definition of _rdtsc() from RCCE_admin.c to RCCE_lib.h and remove the #ifdef SCC. Then you should be able to compile and link.

                • 5. Re: problem compileing RCCE emulator with pwrmgmt=1
                  smeraji

                  ok, I could succesfully compiled it by applying the modifications. but when I try to compile and run the examples in /apps/STENCIL folder, I receive following errors:

                   

                  make pwrmgmt=1 Fdiv
                  g++ -o Fdiv RCCE_Fdiv.o /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_nopwrmgmt.a  -O3 -fopenmp    -I/root/RCCE_v1.1.0/include 
                  RCCE_Fdiv.o: In function `RCCE_APP(int, char**)':
                  RCCE_Fdiv.c:(.text+0x67): undefined reference to `RCCE_power_domain_master()'
                  RCCE_Fdiv.c:(.text+0x99): undefined reference to `print_dividers()'
                  RCCE_Fdiv.c:(.text+0xb0): undefined reference to `RCCE_set_frequency_divider(int, int*)'
                  collect2: ld returned 1 exit status
                  make: *** [Fdiv] Error 1

                   

                  It seems that some of the main Power management functions are not recognized here. I will try to run the same programm on MARC014 and see what happens...

                  • 6. Re: problem compileing RCCE emulator with pwrmgmt=1
                    smeraji

                    I successfully compiled and run program on SCC.

                    • 7. Re: problem compileing RCCE emulator with pwrmgmt=1
                      aprell

                      Doing "make PWRMGMT=1 Fdiv" works for me without problems. I see that you're trying to link against libRCCE_bigflags_nongory_nopwrmgmt.a, which is the wrong kind of archive (power management API disabled). Do you have a corresponding libRCCE_bigflags_nongory_pwrmgmt.a in your RCCE/bin/OMP directory? If not, you need to reconfigure and rebuild.

                      • 8. Re: problem compileing RCCE emulator with pwrmgmt=1
                        smeraji

                        I see what you mean but I do have libRCCE_bigflags_nongory_pwrmgmt.a

                         

                        ~/RCCE_v1.1.0/bin/OMP# ls -all
                        total 328
                        drwxr-xr-x 3 root root  4096 2011-11-11 15:31 .
                        drwxr-xr-x 6 root root  4096 2011-10-28 12:42 ..
                        -rw-r--r-- 1 root root 59134 2011-11-11 15:31 libRCCE_bigflags_gory_nopwrmgmt.a
                        -rw-r--r-- 1 root root 61196 2011-11-11 15:31 libRCCE_bigflags_nongory_nopwrmgmt.a
                        -rw-r--r-- 1 root root 72760 2011-11-03 10:52 libRCCE_bigflags_nongory_pwrmgmt.a
                        -rw-r--r-- 1 root root 59926 2011-11-11 15:31 libRCCE_smallflags_gory_nopwrmgmt.a
                        -rw-r--r-- 1 root root 62076 2011-11-11 15:31 libRCCE_smallflags_nongory_nopwrmgmt.a
                        drwxr-xr-x 6 root root  4096 2011-10-28 12:42 .svn

                         

                        I recompile and run it again here are the errors again:

                         

                        make PWRMGMT=1 Fdiv
                        g++ -o Fdiv RCCE_Fdiv.o /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a  -O3 -fopenmp -DRC_POWER_MANAGEMENT   -I/root/RCCE_v1.1.0/include 
                        RCCE_Fdiv.o: In function `RCCE_APP(int, char**)':
                        RCCE_Fdiv.c:(.text+0x1f): undefined reference to `RCCE_init(int*, char***)'
                        RCCE_Fdiv.c:(.text+0x60): undefined reference to `RCCE_ue()'
                        RCCE_Fdiv.c:(.text+0x67): undefined reference to `RCCE_power_domain_master()'
                        RCCE_Fdiv.c:(.text+0x80): undefined reference to `RCCE_barrier(RCCE_COMM*)'
                        RCCE_Fdiv.c:(.text+0x89): undefined reference to `RCCE_finalize()'
                        RCCE_Fdiv.c:(.text+0x99): undefined reference to `print_dividers()'
                        RCCE_Fdiv.c:(.text+0xb0): undefined reference to `RCCE_set_frequency_divider(int, int*)'
                        /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a(RCCE_emulator_driver.o): In function `main.omp_fn.0':
                        RCCE_emulator_driver.c:(.text+0x66): undefined reference to `RCCE_APP'
                        /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a(RCCE_power_management.o): In function `RC_set_voltage.clone.2':
                        RCCE_power_management.c:(.text+0x136): undefined reference to `_rdtsc'
                        RCCE_power_management.c:(.text+0x25a): undefined reference to `_rdtsc'
                        RCCE_power_management.c:(.text+0x3cd): undefined reference to `_rdtsc'
                        /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a(RCCE_power_management.o): In function `RC_global_clock':
                        RCCE_power_management.c:(.text+0x667): undefined reference to `_rdtsc'
                        /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a(RCCE_power_management.o): In function `RCCE_init_RPC':
                        RCCE_power_management.c:(.text+0x899): undefined reference to `_rdtsc'
                        /root/RCCE_v1.1.0/bin/OMP/libRCCE_bigflags_nongory_pwrmgmt.a(RCCE_power_management.o):RCCE_power_management.c:(.text+0xd23): more undefined references to `_rdtsc' follow
                        collect2: ld returned 1 exit status
                        make: *** [Fdiv] Error 1

                        • 9. Re: problem compileing RCCE emulator with pwrmgmt=1
                          aprell

                          Have you tried to build RCCE from scratch? That is, change into your RCCE directory and perform the following steps:

                           

                          make veryclean

                          ./configure emulator ADD_POWER_API
                          ./makeall

                          • 10. Re: problem compileing RCCE emulator with pwrmgmt=1
                            smeraji

                            Thanks. It works now.

                             

                            I used to do

                            ./configure emulator

                            ./makeall

                            make PWRMGMT=1

                            • 11. Re: problem compileing RCCE emulator with pwrmgmt=1
                              tedk

                              Andreas ...

                               

                              You wrote ...

                              Have you figured it out? What you can do manually until RCCE is patched  is move the definition of _rdtsc() from RCCE_admin.c to RCCE_lib.h and  remove the #ifdef SCC. Then you should be able to compile and link.

                               

                              So does the current RCCE in our SVN not build with power management and the emulator? I can look at RCCE and see if I can make that happen more easily with the appropriate use of #ifdefs. If someone has already done this, please don't keep it a secret.

                              • 12. Re: problem compileing RCCE emulator with pwrmgmt=1
                                tedk

                                Sina,

                                What do you do to get rid of those kooky characters in the gcc error output?

                                 

                                I get

                                /home/tekubasx/sandbox_rcce/rcce/src/RCCE_power_management.c:457: error: â_rdtscâ was not declared in this scope

                                 

                                and then do a LC_ALL=C; export LC-ALL to get a more readable version as

                                /home/tekubasx/sandbox_rcce/rcce/src/RCCE_power_management.c:457: error: '_rdtsc' was not declared in this scope

                                 

                                instead. Is there a better way?

                                • 13. Re: problem compileing RCCE emulator with pwrmgmt=1
                                  tedk

                                  Have you tried to run Fdiv under the emulator? It calls print_dividers() in RCCE_power_management.c which then calls get_divider(). And get_divider() is as follows. For the emulator, it seems to always return 0 ... not very exciting.

                                         400 int get_divider(int tile_ID) {
                                      401 #ifdef SCC
                                      402     int step;
                                      403     unsigned int word;
                                      404     // shift to the right to get the correct bits
                                      405     word = (*(frequency_change_virtual_address[tile_ID]))>>8;
                                      406     for (step=0; step<=16; step++) {
                                      407         if (word==RC_frequency_change_words[step][1]) break;
                                      408     }
                                      409     if (word==RC_frequency_change_words[step][1]) return(step);
                                      410     else                                          return(-1);
                                      411 #else
                                      412     return(0); <== for the emulator (!SCC) always returns 0. Not very exciting.
                                      413 #endif
                                      414 }

                                   

                                  tekubasx@marc101:~/sandbox_rcce/rcce/apps/STENCIL$ rccerun -emulator -nue 1 -f ../../hosts/rc.hosts Fdiv 3
                                  Fdiv 1 0.533 00 3
                                  UE 0, Core ID 0; size of V dom 0 is 1, size of F dom 0 is 1
                                  Requested fdiv: 3, actual fdiv: 3
                                  Clock divider for tile 0 is 0
                                  Clock divider for tile 1 is 0
                                  Clock divider for tile 2 is 0

                                  • 14. Re: problem compileing RCCE emulator with pwrmgmt=1
                                    aprell

                                    Ted,

                                     

                                    You can build the archive, at least with gcc, but linking your final application fails because _rdtsc() was not defined. When you look at RCCE_power_management.c, you find two uses of _rdtsc(), both guarded by #ifndef SCC, so we need this function when we want to use the emulator. _rdtsc() is defined in RCCE_admin.c, but only when we compile for the SCC. I basically just moved the definition to RCCE_lib.h and removed the #ifdef SCC. It's really not much, but I can send you a patch if you want.

                                     

                                    The more interesting question is perhaps why do we need the #ifndef __INTEL_COMPILER around _rdtsc()? Does it pull some GCC specific tricks? I would find this version a bit easier to understand:

                                     

                                    static inline unsigned long long _rdtsc(void)
                                    {
                                        unsigned int lo, hi;
                                        // RDTSC copies contents of 64-bit TSC into EDX:EAX
                                        asm volatile("rdtsc" : "=a" (lo), "=d" (hi));
                                        return (unsigned long long)hi << 32 | lo;
                                    }
                                    1 2 Previous Next