맥북에서 openmp를 돌리기 위해서는 좀 귀찮은 과정이 필요하다. (Visual Studio의 경우 기본적으로 포함되어 있다.)

XCode7 에서는 OpenMP 지원을 하지않기 때문에  

우선 homebrew설치 진행

터미널에서 아래의 코드를 실행하면 된다. (http://wooriworld2006.tistory.com/308)


ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"




나머지 설치 과정은 아래의 스택오버플로우를 참조...

http://stackoverflow.com/questions/33668323/clang-omp-in-xcode-under-el-capitan


2. homebrew를 이용해 openMP 설치

>>brew install clang-omp


3. X code  프로젝트 생성

4. User defined setting 에 CC 항목 추가 한 후  /usr/local/bin/clang-omp 추가

5. Other C flags 항목에 -fopenmp 추가

6. Header Search Path에 /usr/local/include 추가

7. Enable Modules (C and Objective-C) 를 No로 변경하기

8. Build Phases 에서 Link Binary With Libraries 에 /usr/local/lib/libiomp5.dylib 추가

9. symbolic link 추가 (터미널에서 다음 실행)

sudo ln -s /usr/local/bin/clang-omp++ /usr/local/bin/clang++-omp

10. 소스코드에 omp.h 헤더 include

#include "libiomp/omp.h"


===================================================================================

XCode에서 릴리즈한 아이가 제대로 동작하지 않아 gcc++5 를 이용한 방법을 찾아냈다.

http://mathcancer.blogspot.kr/2016/01/PrepOSXForCoding-Homebrew.html


- gcc5 설치 시 make bootstrap 과정에서 꽤나 오랜 시간이 걸리므로 쫄지말자.







'C and C++' 카테고리의 다른 글

Fixed-point in C/C++  (0) 2016.04.05
main function arguments  (0) 2016.03.11
OpenMP  (0) 2016.03.09
C언어 최적화 기법  (0) 2016.02.05
걸음마  (0) 2015.12.08

1.

Visual Studio에서 OpenMP 프로그래밍을 한다면, 프로젝트 옵션에서 openMP 활성화를 해주는 것을 잊지 말자.ㅠ

프로젝트 속성> Configuration Properties> C/C++ > Language > Open MP Support "Yes (/openmp)"





2.

난수를 생성하는 부분은 병렬화를 고려한 랜덤함수를 쓰지 않는 한 병렬화하지 않도록 하자.



'C and C++' 카테고리의 다른 글

main function arguments  (0) 2016.03.11
OpenMP in Macbook  (0) 2016.03.10
C언어 최적화 기법  (0) 2016.02.05
걸음마  (0) 2015.12.08
Fixed point with C++  (0) 2015.12.08

+ Recent posts