Prefetching Examples?

Here’s an actual piece of code that I’ve pulled out of a larger project. (Sorry, it’s the shortest one I can find that had a noticable speedup from prefetching.) This code performs a very large data transpose. This example uses the SSE prefetch instructions, which may be the same as the one that GCC emits. … Read more

OS X 10.9 gcc links to clang

It has been this way for a long time already. The “GCC” that came with 10.8 was really GCC front-end with LLVM back-end. The best way to get GCC is via Homebrew. After the one-line homebrew install command on the bottom of the linked page, you just need: $ brew install gcc49 Unlike macports, Homebrew … Read more

Unable to specify the compiler with CMake

Never try to set the compiler in the CMakeLists.txt file. See the CMake FAQ about how to use a different compiler: https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-do-i-use-a-different-compiler (Note that you are attempting method #3 and the FAQ says “(avoid)”…) We recommend avoiding the “in the CMakeLists” technique because there are problems with it when a different compiler was used for … Read more

How can I have a Makefile automatically rebuild source files that include a modified header file? (In C/C++)

As already pointed out elsewhere on this site, see this page: Auto-Dependency Generation In short, gcc can automatically create .d dependency files for you, which are mini makefile fragments containing the dependencies of the .c file you compiled. Every time you change the .c file and compile it, the .d file will be updated. Besides … Read more