본문 바로가기

개발/유지보수

[Linux] make -j 를 이용한 컴파일 속도 극대화

반응형

make -j{cpu core#} 를 통해 Makefild에서 정의한 컴파일을 보다 빠르게 할 수 있습니다.

 

원리는 병렬적으로(parallel, not interleaving) 컴파일을 수행하여서 멀티코어의 이점을 살리는 것!

 

ex) 4코어 시스템이라면 make -j4

 

더 찾아보니 코어 수의 20% upperbound 로 매개변수를 잡는 것이 가장 좋은 성능을 낸다고 합니다.

8코어라면 8*1.2의 올림인 10 -> make -j10

 

또한 가상코어(쓰레드)가 실제코어 수보다 크다면 가상코어 수를 매개변수의 기준으로 잡으면 됩니다.

 

 

 

 

 

 

아래는 make의 j옵션 매개변수에 대해 찾아보며 도움이 됐던 게시글

 

https://unix.stackexchange.com/questions/208568/how-to-determine-the-maximum-number-to-pass-to-make-j-option

 

How to determine the maximum number to pass to make -j option?

I want to compile as fast as possible. Go figure. And would like to automate the choice of the number following the -j option. How can I programmatically choose that value, e.g. in a shell scrip...

unix.stackexchange.com

 

https://m.blog.naver.com/CommentList.nhn?blogId=invain&logNo=80094907942

 

Geunsik Lim's BLOG : 네이버 블로그

http://leemgs.fedorapeople.org

blog.naver.com

 

반응형