In order to check whether AVX or SSE is available, the compiler usually sets SSE or AVX true. However is there an option, how to receive during compile time the size of the cache?
Edit: I refrase the question a little bit, since it is not clear enough.
I want information about the cache during compile time. The more the better. I would like to have it for optimization purposes (i.e. cache-blocking,...). In my current task - spatial blocking - the size of the cache is mostly relevant. But the comments bellow rightly asked, which level of cache am i asking for. In addition caches can behave very differrently, if you consider their evicting strategy, size of cache line, amount of levels, how they are shared between cores... The list goes on.
So my general question: How do i recieve any information about the cache during compile time?
For my current task, it would be sufficient to readout /proc/cpuinfo and use the cachesize given there. However the general question is far more interesting.
How do i recieve information about the cpu (with focus on its cache) during compile time?
(I am not considering of crosscompiling at all. The code compiled will be run on the SAME machine.)
Aucun commentaire:
Enregistrer un commentaire