What does “an intermediate result is being cached” mean?

后端 未结 1 1937
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 08:03

I have a set of n vectors stored in the 3 x n matrix z. I find the outer product using np.einsum. When I timed it using:

相关标签:
1条回答
  • 2020-11-29 08:30

    The message "intermediate result is being cached" is just a blind guess in the canned message reported by %timeit. It may or may not be true, and you should not assume it is correct.

    In particular, one of the most common reasons for the first run being slowest is that the array is in the CPU cache only after the first run.

    CPUs cache things automatically; you cannot avoid this, and you don't really want to avoid it. However, optimizing algorithms so that CPU caches can work optimally is nowadays one of the bottlenecks that high-performance computing needs to take into account.

    0 讨论(0)
提交回复
热议问题