Lab : OpenMP Programming Parallel Programming (CS5423) Instructor : 鍾葉青 Author : 吳宇宸
Note! OpenMP 必須由編譯器本身支援,無法以套件 方式使用。 使用 OpenMP 前,務必先確定你的編譯器有支 援 OpenMP
Compilers and Platforms IBM XL Fortran and C from IBM IBM AIX Systems Intel C++ and Fortran Compilers Linux (IA32,EM64T, Itanium) Windows 2K,XP (32bits,64bits) MAC OS Sun Microsystems Sun Studio Compilers and Tools Sun Studio 11 OMPlab Presentation, IWOMP 2005 Others… GCC 4.2 (new!!)
開發模式 模式 1 整合 Microsoft Visual C++ (studio).NET 2003 模式 2 終端機指令模式
模式一 整合 MS VC++ Step 1. 用一般方式建立自己所需的方案 Step 2. 轉換成 intel 方案
模式一 整合 MS VC++ Step3. 設定專案屬性
模式一 整合 MS VC++ Step4. 調整屬性 “ C/C++ -> Language -> Process OpenMP Directives
模式一 整合 MS VC++ Step 5. 執行編譯 Demo
模式二 終端機指令模式 Step1. 開始 > 所有程式 > Intel(R) Software Development Tools > Intel(R) C++ Compiler 9.1 > Build Environment for C++ EM64T-based applications 不該有錯誤訊息!
模式二 終端機指令模式 Step2 Intel C++ compiler 的執行指令為 icl , 可輸入 ”icl /help” 來查閱完整資訊 若有使用 OpenMP X:\yourdir\>icl /Qopenmp yourfile.c Demo
Intel C++ compiler 其他常用參數 Optimize /O0 : disable /O : same as /O2 /O1 : Optimize to favor code size and code locality. Disables loop unrolling. /O2 : default /O3 : enable high-level optimization Others /S compile to assembly file /I add directory to include file search path Other…(try “icl /?” !)