Thursday, June 7, 2012

I figured out how to have `make` stretch my CPU's 8 cores!

While trying to build OpenCV from scratch, I continuously ran into compile errors.

These would happen ~5 minutes (25%) into the make process.

Using an i7 CPU, I wondered why the compilation was taking so long for a relatively small project. I checked the output of "top" and noticed that the load was hovering around 1, which for an 8 core processor is nothing short of lazy.

A short trip to google told me that the following will let me tell "make" how many cores I want it to use.

make -jX

e.g. make -j8 allowed me to use all 8 cores and therefore cut the compile time accordingly.

SCORE :D

No comments:

Post a Comment