This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Matrix to Matrix Multiplication

Hello ,

I have written One simple matrix to Matrix multiplication code and trying to run on CCS. When I am giving matrix Size up to 15, It is working and showing me outputs on individual cores. But, Once I am giving matrix Size 20, or on wards, it is not showing me any output on Console. Do I am missing something here. 

Second, I am trying to calculate time consumption during that matrix multiplication and i have used same told by one of your Guys: Travis as below:
#include <stdio.h>

#include<c6x.h>

unsigned int t_start_l,t_start_h;
unsigned int t_stop_l,t_stop_h;
unsigned int t_overhead_l,t_overhead_h;

int main(int argc, char *argv[])
{
   int i;
   TSCL = 0;
   TSCH = 0;
   t_start_l = TSCL;
   t_start_h = TSCH;
   for (i=0; i<100000000; i++)
   {
      ;
   }
   t_stop_l = TSCL;
   t_stop_h = TSCH;
   t_overhead_l = t_stop_l - t_start_l;
   t_overhead_h = t_stop_h - t_start_h;
   printf("done, t_overhead_h = 0x%08x\tt_overhead_l=0x%08x\n",t_overhead_h,t_overhead_l);
}, 

Now My doubt is it is giving me some values like: t_overhead_h = 0x00000000 t_overhead_l=0x00085e03, What are these values, Is this time taken during calculation in hexadecimal format or just any random values?

Third, I am trying all this on C6678 board and I have make one simple, Empty project and write my code in main. but, Under this, I am not getting option of Empty RTSC project, I have done Installation twice, but No help. 

Fourth, I am also trying to use Multicore System Analyzer, Profile and graph thing on CCS to see various graphs related with these, so I need to do anything extra here, or how to use those things. And, also can anybody tell, what does pin connect and Port Connect will tell us? 

If there will be any tutorial which will show using all these thing then that will be much more helpful. I am sorry for my these questions, but I am trying to learn on this and see things how work and understand it. 
Thanks. 


  • Arun,

    "When I am giving matrix Size up to 15, It is working and showing me outputs on individual cores. But, Once I am giving matrix Size 20, or on wards, it is not showing me any output on Console."

    Can you elaborate a little here? What is the output you are expecting? Is it the printf statement that you have in your TSC code? Did it not print because of some failure before you reached printf? You can step through the code (F5) and see what is going wrong.

    "Now My doubt is it is giving me some values like: t_overhead_h = 0x00000000 t_overhead_l=0x00085e03, What are these values, Is this time taken during calculation in hexadecimal format or just any random values?"

    No it is not random. The delta between two TSC reads will give you the time spent between the two reads in # of CPU clock cycles.

    "Third, I am trying all this on C6678 board and I have make one simple, Empty project and write my code in main. but, Under this, I am not getting option of Empty RTSC project, I have done Installation twice, but No help."

    I am not too familiar with RTSC projects so I will get an expert to help you out here.

    "Fourth, I am also trying to use Multicore System Analyzer, Profile and graph thing on CCS to see various graphs related with these, so I need to do anything extra here, or how to use those things."

    Here are links for help on Statistical profiling and function profiling.Let me know if you have any more questions.

  • Hello Aditya!

    Thanks for your reply. Well, I on a lay man word, I want to see how matrix to matrix multiplication work on DSP6678 board. I have started with simple one and will go to Single Precision, double and complex one and I am basically interested in its performance. Now, At this very moment I am only printing how much time it is taking in calculation of Matrix multiplication. Now, 

    #define N 15

     

    TSCL = 0;
    TSCH = 0;
    t_start_l = TSCL;
    t_start_h = TSCH;

    for (i=0; i<N; i++)
    {
    for (j=0; j<N; j++)
    {
    C[i][j]=0;
    for (k=0; k<N; k++)
    {
    C[i][j]=C[i][j]+A[i][k]*B[k][j];
    }
    }
    }
    
    
    t_stop_l = TSCL;
    t_stop_h = TSCH;
    t_overhead_l = t_stop_l - t_start_l;
    t_overhead_h = t_stop_h - t_start_h;
    printf("Time Taken during Matrix multiplication is: , t_overhead_h = 0x%08x\tt_overhead_l=0x%08x\n",t_overhead_h,t_overhead_l);
    
    
    
    
    Basically this is a section of my code and it is giving me some time in hexadecimal values upto N= 15. Once I am putting matrix size 20by 20 and N=20 then it is not showing 
    me any thing on console. Although It builds fine and It is also not giving any error message or something. I am not sure why it is happening.   

    Second, you have said that TSC will give me  time spent between the two reads in # of CPU clock cycles, this is in Milliseconds or nanoseconds? And, how can i get something 
    total time spent in write or i mean performance wise.

    Regarding RTSC thing, I got its solution, so never mind, and thanks for  giving me link for statistical profiling, But functional one is not working.

    Thanks. 
  • Do you have optimization enabled? Do you think the printf statement might be getting optimized out? I am not too well versed with CCS configuration so I want to start with some basic questions.

    In your example, the delta = 0x00085e03 = 548,355 CPU clock cycles. So at 1GHz CPU frequency, 1 clock = 1ns. Thus, what you have in your example = 548.355 ms. I'll try to see if I can get you a working link on function profiling.

  • Hello Aditya,

    very frankly, I don't know how to enable optimization.  Well, i have just go with default settings. If I am  not wrong, then we can do it under C6000 compiler option and then under optimization right?  If you can give me some idea or link which can show how to enable those special functional things then I will appreciate your help.

    Thanks.  

  • Arun, you can right click on your project -> Build Options -> C6000 compiler -> basic options. Can you check what is says against Optimization level?

  • Hello Aditya,

    It is showing 0, is there any link or document where I can get some knowledge about these kind of stuffs. Forgive me for my poor knowledge!  

  • Arun, you can read more about optimization here : http://www.ti.com/lit/ug/spru187t/spru187t.pdf

  • Thanks Aditya!

    Let me try with optimization levels and see how things work. I will keep here posted if i come across anything else. And, please see if you can give me something more detailed working links for profiling.

    Thanks for your Support!