49 graphical interpretation of blocked matrix

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: per second (MB/s). If we were to write a program that issued a sequence of read requests from a tight program loop, then the measured read throughput would give us some insight into the performance of the memory system for that particular sequence of reads. Figure 6.40 shows a pair of functions that measure the read throughput for a particular read sequence. code/mem/mountain/mountain.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 void test(int elems, int stride) /* The test function */ { int i, result = 0; volatile int sink; for (i = 0; i < elems; i += stride) result += data[i]; sink = result; /* So compiler doesn’t optimize away the loop */ } /* Run test(elems, stride) and return read throughput (MB/s) */ double run(int size, int stride, double Mhz) { double cycles; int elems = size / sizeof(int); test(elems, stride); /* warm up the cache */ cycles = fcyc2(test, elems, stride, 0); /* call test(elems,stride) */ return (size / stride) / (cycles / Mhz); /* convert cycles to MB/s */ } code/mem/mountain/mountain.c Figure 6.40: Functions that measure and compute read throughput. The test function generates the read sequence by scanning the...
View Full Document

Ask a homework question - tutors are online