Sixteen Times The Misses

An int A[4000][4000] (64 MB, far larger than any cache) is summed twice: once row by row, once column by column. Cache lines are 64 bytes, int is 4 bytes, and the hardware prefetcher is disabled.

How many cache misses does each traversal cost?

A

62,500 row-major and 1,000,000 column-major.

B

1,000,000 row-major and 16,000,000 column-major.

C

16,000,000 both ways: the same 16 million elements get read either way.

D

1,000,000 row-major and 4,000,000 column-major.