前文〝
安裝 OpenCL 程式框架 (五):AMD CPU〞的安裝步驟因 AMD 未再更新其 CPU 的 OpenCL 程式框架,恐影響 OpenCL 之效能,故擬採用 pocl 的 OpenCL 程式框架。參考〝
安裝 OpenCL 程式框架 (一):pocl〞安裝完成後,開始測試,
[SiB@A10-R7 ~]$ ./Hello_All_OpenCL
There are 2 platforms in this system.
1.Clover, OpenCL 1.1 Mesa 17.3.6, 1 device.
1-1.[GPU] AMD KAVERI (DRM 2.50.0 / 4.15.9-300.fc27.x86_64, LLVM 5.0.1), 17.3.6, 8 Compute Units, 866 MHz.
OpenCL 1.1 Mesa 17.3.6, OpenCL C 1.1 (1.1), 64-bit Little-Endian.
Computed '1000000/1000000' correct values! ( 0.306309 us)
2.Portable Computing Language, OpenCL 1.2 pocl 0.15-pre, LLVM 5.0.0, 1 device.
2-1.[CPU] pthread-AMD A10-7890K Radeon R7, 12 Compute Cores 4C+8G, 0.15-pre, 4 Compute Units, 4100 MHz.
OpenCL 1.2 pocl HSTR: pthread-x86_64-unknown-linux-gnu-haswell, OpenCL C 1.2 pocl(1.2), 64-bit Little-Endian.
1 error generated.
Error: Failed to build program executable! (-11)
error: <built-in>:2:10: '/usr/lib64/clang/5.0.0/include/opencl-c.h' file not found
出現缺少 opencl-c.h 的訊息,可能是哪個關聯套件未安裝所致。用 DNF 查詢缺了哪個套件?
[root@A10-R7 ~]# dnf provides *opencl-c.h
上次中介資料過期檢查:0:00:00 以前,時間點為 西元2018年03月20日 (週二) 10時39分43秒
castxml-0.1-0.22.20180122git6952441.fc27.x86_64 : C-family abstract syntax tree XML output tool
軟體庫 :updates
符合之來源
Other : *opencl-c.h
clang-5.0.1-3.fc27.i686 : A C language family front-end for LLVM
軟體庫 :updates
符合之來源
Other : *opencl-c.h
clang-5.0.1-3.fc27.x86_64 : A C language family front-end for LLVM
軟體庫 :updates
符合之來源Other : *opencl-c.h
root-cling-6.12.06-1.fc27.i686 : Cling C++ interpreter
軟體庫 :updates
符合之來源Other : *opencl-c.h
root-cling-6.12.06-1.fc27.x86_64 : Cling C++ interpreter
軟體庫 :updates??????
Other : *opencl-c.h
castxml-0.1-0.19.20170301gitfab9c47.fc27.x86_64 : C-family abstract syntax tree XML output tool
軟體庫 :fedora
符合之來源Other : *opencl-c.h
clang-4.0.1-5.fc27.i686 : A C language family front-end for LLVM
軟體庫 :fedora
符合之來源Other : *opencl-c.h
clang-4.0.1-5.fc27.x86_64 : A C language family front-end for LLVM
軟體庫 :fedora
符合之來源Other : *opencl-c.h
root-cling-6.10.06-1.fc27.i686 : Cling C++ interpreter
軟體庫 :fedora
符合之來源Other : *opencl-c.h
root-cling-6.10.06-1.fc27.x86_64 : Cling C++ interpreter
軟體庫 :fedora
符合之來源Other : *opencl-c.h
由結果看來,應該是 Clang 這個套件,補安裝後再測試
[SiB@A10-R7 ~]$ ./Hello_All_OpenCL
There are 2 platforms in this system.
1.Clover, OpenCL 1.1 Mesa 17.3.6, 1 device.
1-1.[GPU] AMD KAVERI (DRM 2.50.0 / 4.15.9-300.fc27.x86_64, LLVM 5.0.1), 17.3.6, 8 Compute Units, 866 MHz.
OpenCL 1.1 Mesa 17.3.6, OpenCL C 1.1 (1.1), 64-bit Little-Endian.
Computed '1000000/1000000' correct values! ( 0.327331 us)
2.Portable Computing Language, OpenCL 1.2 pocl 0.15-pre, LLVM 5.0.0, 1 device.
2-1.[CPU] pthread-AMD A10-7890K Radeon R7, 12 Compute Cores 4C+8G, 0.15-pre, 4 Compute Units, 4100 MHz.
OpenCL 1.2 pocl HSTR: pthread-x86_64-unknown-linux-gnu-haswell, OpenCL C 1.2 pocl(1.2), 64-bit Little-Endian.
1 error generated.
Error: Failed to build program executable! (-11)
error: <built-in>:2:10: '/usr/lib64/clang/5.0.0/include/opencl-c.h' file not found
error: <built-in>:2:10: '/usr/lib64/clang/5.0.0/include/opencl-c.h' file not found
仍有錯誤訊息,查看安裝的 Clang 版本,似乎要的版本是 5.0.0 而系統安裝的是 5.0.1 版。而套件資料中也無 5.0.0 版的 Clang,想說用 ln 建立一個『檔案連結』看能不能騙過系統,
[root@A10-R7 ~]# cd /usr/lib64/clang/
[root@A10-R7 clang]# ll
總計 4
drwxr-xr-x. 4 root root 4096 3月 20 10:43 5.0.1
[root@A10-R7 clang]# ln -s 5.0.1 5.0.0
[root@A10-R7 clang]# ll
總計 4
lrwxrwxrwx. | 1 | root | root | 5 | 3月 20 10:45 | 5.0.0 -> 5.0.1 |
drwxr-xr-x. | 4 | root | root | 4096 | 3月 20 10:43 | 5.0.1 |
[root@A10-R7 clang]#
再試一次,
[SiB@A10-R7 ~]$ ./Hello_All_OpenCL
There are 2 platforms in this system.
1.Clover, OpenCL 1.1 Mesa 17.3.6, 1 device.
1-1.[GPU] AMD KAVERI (DRM 2.50.0 / 4.15.9-300.fc27.x86_64, LLVM 5.0.1), 17.3.6, 8 Compute Units, 866 MHz.
OpenCL 1.1 Mesa 17.3.6, OpenCL C 1.1 (1.1), 64-bit Little-Endian.
Computed '1000000/1000000' correct values! ( 0.318292 us)
2.Portable Computing Language, OpenCL 1.2 pocl 0.15-pre, LLVM 5.0.0, 1 device.
2-1.[CPU] pthread-AMD A10-7890K Radeon R7, 12 Compute Cores 4C+8G, 0.15-pre, 4 Compute Units, 4100 MHz.
OpenCL 1.2 pocl HSTR: pthread-x86_64-unknown-linux-gnu-haswell, OpenCL C 1.2 pocl(1.2), 64-bit Little-Endian.
Computed '1000000/1000000' correct values! ( 0.037635 us)
AMD 的 CPU 又可以用在 OpenCL 程式框架了。
已測試版本:
沒有留言:
張貼留言
感謝你耐心看完本文,歡迎留下任何指正、建議,筆者會儘快回應。(English is also welcome.)