一、下載 OpenCL 程式框架安裝套件
Intel CPU 的 OpenCL 程式框架是需要安裝特別的套件,由官方的下載點下載,本文以『 OpenCL™ Runtime 15.1 for Intel® Core™ and Intel® Xeon® Processors for Red Hat* and SLES* Linux* (64-bit)』為例,目前的最新版為 opencl runtime 15.1。假設下載的暫存目錄在 SiB 的家目錄下之 Temp 目錄中,將該下載檔解壓縮,可以在 opencl_runtime_15.1_x64_5.0.0.57 目錄下可以看到安裝檔,
[SiB@Celeron-D Temp]$ tar zxf opencl_runtime_15.1_x64_5.0.0.57.tgz上面檔案列表中 *.rpm 就是 Fedora 的安裝檔,不過它有提供安裝腳本檔 install.sh,用它來安裝應該是較佳的選擇。
[SiB@Celeron-D Temp]$ ls -w1 opencl_runtime_15.1_x64_5.0.0.57
EULA.txt
install_GUI.sh
install.sh
pset
PUBLIC_KEY.PUB
rpm
silent.cfg
[SiB@Celeron-D Temp]$ ls -w1 opencl_runtime_15.1_x64_5.0.0.57/rpm/
opencl-1.2-base-5.0.0.57-1.x86_64.rpm
opencl-1.2-base-pset-5.0.0.57-1.noarch.rpm
opencl-1.2-intel-cpu-5.0.0.57-1.x86_64.rpm
二、安裝 OpenCL 程式框架程式
確定安裝腳本檔所在的目錄後,在「終端機」中先切換為 root 身分,再下安裝命令。[root@Celeron-D ~]# /home/SiB/Temp/opencl_runtime_15.1_x64_5.0.0.57/install.sh出現一個啟始安裝的畫面,
--------------------------------------------------------------------------------稍等一下,就開始安裝步驟
Initializing, please wait...
--------------------------------------------------------------------------------
Step 1 of 6 | Welcome顯示安裝過程的六個步驟,按【Enter】鍵繼續。這時會開始檢查系統是否支援
--------------------------------------------------------------------------------
Welcome to the OpenCL™ runtime for Intel® Core™ and Xeon® processors, and Intel® Xeon Phi™ coprocessors (15.1) installation program.
--------------------------------------------------------------------------------
You will complete the steps below during this installation:
Step 1 : Welcome
Step 2 : License agreement
Step 3 : Intel(R) Software Improvement Program
Step 4 : Options
Step 5 : Installation
Step 6 : Complete
--------------------------------------------------------------------------------
press "Enter" to continue, or "q" to quit:
--------------------------------------------------------------------------------接著,顯示出檢查的結果。
Checking the prerequisites. It can take several minutes. Please wait...
--------------------------------------------------------------------------------
Step 1 of 6 | Prerequisites > Missing Optional Prerequisite(s)上例是說『作業系統未支援』,不想理它!就按【Enter】鍵,直接忽略它。
--------------------------------------------------------------------------------
There are one or more optional unresolved issues. It is highly recommended to resolve them all before you continue the installation. You can fix them without exiting from the installation and re-check. Or you can quit from the installation, fix them and run the installation again.
--------------------------------------------------------------------------------
Missing optional prerequisites
-- Unsupported OS
--------------------------------------------------------------------------------
1. Skip missing optional prerequisites [default]
2. Show the detailed info about issue(s)
3. Re-check the prerequisites
h. Help
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [1]:
或者是按【2】看詳情
Step 1 of 6 | Prerequisites > Missing Optional Prerequisite(s)訊息是說『此套件只在 SUSE Linux 11 或 Red Hat Enterprise LinuxOS 6 驗證過』,Fedora 並不在其驗證範圍,按【1】繼續。
--------------------------------------------------------------------------------
Detected operating system is not supported. Supported operating systems for this release are:
- SUSE Linux Enterprise Server* 11 (Intel(R) 64);
- Red Hat Enterprise Linux* 6 (Intel(R) 64);
--------------------------------------------------------------------------------
1. Finish with prerequisites and continue installation [default]
2. Show the detailed info about issue(s)
h. Help
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [1]:
Step 2 of 6 | License agreement想繼續看就按【空白】鍵,或按【q】跳過。
--------------------------------------------------------------------------------
As noted in the Intel(R) Software Development Products End User License
Agreement, the Intel(R) Software Development Products you install will send Intel the product's serial number and other system information to help Intel improve the product and validate license compliance. No personal information will be transmitted.
--------------------------------------------------------------------------------
To continue with the installation of this product you are required to accept the terms and conditions of the End User License Agreement (EULA). The EULA is displayed using the 'more' utility. Press the space bar to advance to the next page or enter 'q' to skip to the end. After reading the EULA, you must enter 'accept' to continue the installation or 'decline' to return to the previous menu.
--------------------------------------------------------------------------------
End User License Agreement
IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
Do not copy, install, or use the Materials provided under this license agreement ("Agreement"), until you have carefully read the following terms and conditions. By copying, installing, or otherwise using the Materials, you agree to be bound by the terms of this Agreement. If you do not agree to the terms of this Agreement, do not copy, install, or use the Materials. End User License Agreement for the Intel(R) Software Development Products
1. LICENSE DEFINITIONS:
A. "Materials" are defined as the software, documentation, license key codes and other materials, including any updates and upgrade thereto, that are provided to you under this Agreement. Materials also include the Redistributables, Cluster OpenMP Library, and Sample Source as defined below.
B. "Redistributables" are the files listed in the following text files that may be included in the Materials for the applicable Intel Software Development Product: clredist.txt, credist.txt, fredist.txt, redist.txt.
C. "Cluster OpenMP Library", is comprised of the files listed in the "clredist.txt" file specified above, is the Intel(R) Cluster OpenMP* Library add-on option to the Intel(R) C++ Compiler for Linux* and Intel(R) Fortran Compiler for Linux* products ("Intel Compiler for Linux"). The use of the Cluster OpenMP Library is conditioned on having a valid license from Intel for the Cluster OpenMP Library and for either Intel Compiler for Linux, and further is governed by the terms and conditions of the license agreement for applicable the Intel Compiler for Linux.
--更多--[按下空格以繼續,「q」表示離開。]
--------------------------------------------------------------------------------慎重其事地問:是否同意其授權宣告,輸入 accept 這個字繼續下一步。
Do you agree to be bound by the terms and conditions of this license agreement?
Type 'accept' to continue or 'decline' to go back to the previous menu:
Step 3 of 6 | Intel(R) Software Improvement ProgramIntel 詢問是否參與其「軟體改善計劃」,同意選 1,不同意選 2。
--------------------------------------------------------------------------------
Help improve your experience with Intel(R) software
Participate in the design of future Intel software. Select 'Yes' to give us permission to learn about how you use your Intel software and we will do the rest.
- No personally identifiable information is collected
- There are no additional follow-up emails by opting in
- You can stop participating at any time
Learn more about the Intel(R) Software Improvement Program
http://software.intel.com/en-us/articles/software-improvement-program
With your permission, Intel may automatically receive anonymous information about how you use your current and future Intel(R) Software Development Products.
--------------------------------------------------------------------------------
1. Yes, I am willing to participate and improve Intel software. (Recommended)
2. No, I don't want to participate in the Intel(R) Software Improvement Program at this time.
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection:
Step 4 of 6 | Options > Pre-install Summary最後,列出要安裝的套件總共需要 104 MB,並等待確認,按【Enter】鍵後繼續。
--------------------------------------------------------------------------------
Install location:
/opt/intel/opencl-1.2-5.0.0.57
Component(s) selected:
OpenCL™ runtime for Intel® Core™ and Xeon® processors, and Intel® 104MB
Xeon Phi™ coprocessors (15.1)
OpenCL™ installable client driver loader
OpenCL™ runtime for Intel® CPU device
Install Space Required: 104MB
1. Start installation Now [default]
2. Customize installation
h. Help
b. Back to the previous menu
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [1]:
Step 5 of 6 | Installation安裝步驟結束,按【Enter】鍵繼續。
--------------------------------------------------------------------------------
Each component will be installed individually. If you cancel the installation, some components might remain on your system. This installation may take several minutes, depending on your system and the options you selected.
--------------------------------------------------------------------------------
Installing OpenCL™ installable client driver loader component... done
--------------------------------------------------------------------------------
Installing OpenCL™ runtime for Intel® CPU device component... done
--------------------------------------------------------------------------------
Installing Uninstaller component... done
--------------------------------------------------------------------------------
Finalizing product configuration...
--------------------------------------------------------------------------------
Press "Enter" key to continue
Step 6 of 6 | Complete最後一個步驟,按【Enter】鍵結束安裝腳本。
--------------------------------------------------------------------------------
Thank you for installing and for using the OpenCL™ runtime for Intel® Core™ and Xeon® processors, and Intel® Xeon Phi™ coprocessors (15.1).
--------------------------------------------------------------------------------
q. Quit
--------------------------------------------------------------------------------
Please type a selection or press "Enter" to accept default choice [q]:
三、查詢 OpenCL
安裝後,就用 CLInfo 查詢安裝結果,由上面的查詢結果可以看到,Intel 的 CPU 已經變成 OpenCL 的運算單元了。不過,上例中測試的 CPU 只是 Celeron 2.66 GHz,大概只能用來練習寫 OpenCL 程式而已。
[SiB@Core-i7 ~]# clinfo Number of platforms 1 Platform Name Intel(R) OpenCL Platform Vendor Intel(R) Corporation Platform Version OpenCL 1.2 Platform Profile FULL_PROFILE Platform Extensions cl_intel_accelerator cl_intel_advanced_motion_estimation cl_intel_motion_estimation cl_intel_subgroups cl_intel_va_api_media_sharing cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_spir Platform Name Intel(R) OpenCL Number of devices 1 Device Name Intel(R) Celeron(R) CPU 2.66GHz Device Vendor Intel(R) Corporation Device Version OpenCL 1.2 (Build 57) Driver Version 1.2.0.57 Device OpenCL C Version OpenCL C 1.2 Device Type CPU Device Profile FULL_PROFILE Max compute units 1 Max clock frequency 2660MHz · · · · · · Address bits 64, Little-Endian · · · · · · NULL platform behavior clGetPlatformInfo(NULL, ...) No platform · · · · · · clCreateContextFromType( ...) No platform
後記:
- 其它 OpenCL 程式框架的安裝,請參考〝OpenCL 程式框架與 CLInfo〞。
- 2016-8-27 : 安裝新版 opencl_runtime_16.1.1_x64_rh_6.4.0.25 時,安裝程式需要 libtinfo.so.5 函式庫,先用『dnf install ncurses-compat-libs』命令安裝好即可。
已測試版本:
- Fedora 23 ~ 24 + Intel® Core™ i7-4720HQ CPU @ 2.60GHz
- Fedora 23 ~ 24 + Intel® Core™ i7-2670QM CPU @ 2.20GHz
- Fedora 21 + Intel® Celeron® CPU 2.66GHz
沒有留言:
張貼留言
感謝你耐心看完本文,歡迎留下任何指正、建議,筆者會儘快回應。(English is also welcome.)