vendredi 29 mai 2015

performance cache memories with buffer

like a class exercise I need to work with cache memories.

This is the statement:

  Your program should measure average bandwidth of the byte access during
  many rounds of execution of the following two subroutines:

  subroutine A: increment all bytes of a memory buffer containing 2*s1
  bytes in the order of increasing memory addresses;

  subroutine B: increment each b1-th byte of a memory buffer containing 2*s1 
  bytes in the order of increasing memory addresses;

  Subroutines B employ the memory buffer which is exactly twice as large as
  the capacity of the analyzed cache L1. By using such memory buffers we
  ensure that the buffer is smaller than the capacity of the memory at the
  next level of the memory hierarchy (if we are testing L1, the buffer is
  smaller than L2).

  Each of these two subroutines has to be invoked many times in the loop.
  We see that the subroutine A relatively seldom generates L1 cache misses    
  (once in b1 accesses). Subroutine B generates a L1 cache miss in each
   memory access, but a majority of these accesses shall fall inside L2

  For each subroutine, your program should determine average time of a byte
  access, as well as the achieved bandwidth in MB/s. Based on the obtained
  data, estimate the ratios of the latencies corresponding to neighbouring
  levels of the memory hierarchy (t(L2)/t(L1), t(RAM)/t(L2)).

I have done the subroutine A, but subroutine B, I do not really understand how to increment that.

This is subroutine A. I think that I did it correctly (just increment all buffer and I checked for cache misses with perf like this ¨perf stat -e cache-misses ./lab¨, but it put me it is not supported ):

My cache is capacity of L1 cache 32kb (s1). Line witdh 64 bytes.

char buffer1[2*32768];

I fill out this buffer with aleatory.

void subroutine_A(char *buffer1)
{
   buffer1++; 
}

It is the first time that I have to work with this and I am quite lost, I checked on internet, but I did not find anything really helpfull for me and I am trying to do this since long time ago, so, with any help I would be really gratefull :)

Thanks.

Aucun commentaire:

Enregistrer un commentaire