{"id":615,"date":"2019-01-05T10:58:02","date_gmt":"2019-01-05T01:58:02","guid":{"rendered":"http:\/\/p-0.me\/b\/?p=615"},"modified":"2019-01-05T10:58:02","modified_gmt":"2019-01-05T01:58:02","slug":"593","status":"publish","type":"post","link":"https:\/\/p-0.me\/b\/p\/593\/","title":{"rendered":"Raspberry Pi\u3067OpenCL\u3092\u89e6\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>FPGA\u3067OpenCL\u3092\u89e6\u3063\u3066\u307f\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u3066\uff0c\u3067\u3082FPGA\u306f\u7279\u6b8a\u306a\u306e\u3067\uff0c\u524d\u6bb5\u968e\u3068\u3057\u3066Raspberry Pi\u3067OpenCL\u3092\u89e6\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\uff0e<br \/>\n\u4eca\u56de\u306f\u79c1\u304c\u6240\u6301\u3057\u3066\u3044\u308bRaspberryPi2B\u3067\u8a71\u3092\u9032\u3081\u308b\u304c\uff0cGPU\u306f\u3059\u3079\u3066\u306e\u30b7\u30ea\u30fc\u30ba\u306b\u642d\u8f09\u3055\u308c\u3066\u3044\u308b\u305f\u3081\uff0cRPi3\u306a\u3069\u3067\u3082\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\uff0e<br \/>\n<!--more--><br \/>\n&nbsp;<\/p>\n<h3>\u6982\u8981<\/h3>\n<p>Raspberry Pi\u306eCPU\u3084GPU\u306e\u6a5f\u80fd\u306f\uff0cSoC\u306e\u5f62\u30671\u30c1\u30c3\u30d7\u306b\u53ce\u3081\u3089\u308c\u3066\u3044\u308b\uff0e<br \/>\nGPU\u306fVideoCore IV\u3068\u3044\u3046\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u304c\u4f7f\u7528\u3055\u308c\uff0c\u3053\u308c\u306b\u95a2\u3059\u308b\u8cc7\u6599\u306f<a href=\"https:\/\/www.raspberrypi.org\/documentation\/hardware\/raspberrypi\/bcm2835\/README.md\">BCM2835\u306e\u30da\u30fc\u30b8<\/a>\u306e<a href=\"https:\/\/docs.broadcom.com\/docs\/12358545\">GPU Documentation<\/a>\u304b\u3089\u95b2\u89a7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\uff0e<br \/>\nVideoCore IV\u3092OpenCL\u304b\u3089\u6271\u3046\u305f\u3081\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066<a href=\"https:\/\/github.com\/doe300\/VC4CL\">VC4CL<\/a>\u304c\u3042\u308b\u305f\u3081\uff0c\u4eca\u56de\u306f\u3053\u308c\u3092\u4f7f\u3046\uff0e<br \/>\n&nbsp;<\/p>\n<h3>VC4CL<\/h3>\n<p>OpenCL1.2\u3092\u4f7f\u3063\u3066VideoCore IV\u3092\u89e6\u308b\u305f\u3081\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3089\u3057\u3044\uff0e\u74b0\u5883\u8a2d\u5b9a\u306e\u65b9\u6cd5\u306b\u95a2\u3057\u3066\u306f<a href=\"https:\/\/github.com\/doe300\/VC4CL\/wiki\/How-to-get\">How to get<\/a>\u3092\u53c2\u8003\u306b\u884c\u3046\uff0e<br \/>\n\u57fa\u672c\u7684\u306b\u306f<a href=\"https:\/\/github.com\/doe300\/VC4CL\/wiki\/How-to-get\">How to get<\/a>\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30b3\u30d4\u30da\u3059\u308c\u3070\u826f\u3044\u304c\uff0cdpkg -i\u3092\u884c\u3063\u305f\u969b\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u8db3\u308a\u306a\u3044\u3068\u8a00\u308f\u308c\u308b\u4e8b\u304c\u3042\u308b\uff0e<br \/>\n\u79c1\u306e\u74b0\u5883\u3067\u306fvc4c.deb\u306e\u3068\u304d\u306b\u306fclang-3.9,llvm-3.9,llvm-3.9-dev\u306e3\u3064\uff0cvc4cl.deb\u3067\u306fopencl-c-headers\u3068ocl-icd-opencl-dev\u306e2\u3064\u304c\u8db3\u308a\u306a\u3044\u3068\u8a00\u308f\u308c\u305f\uff0e<br \/>\n\u8db3\u308a\u306a\u3044\u306e\u3067apt-get install\u3067\u5165\u308c\u3088\u3046\u3068\u3057\u305f\u3089&#8221;apt &#8211;fix-broken install\u201d\u3092\u4f7f\u3048\u3068\u8a00\u308f\u308c\u305f\u306e\u3067\uff0c\u9069\u5b9c\u3053\u308c\u3092\u5b9f\u884c\uff0e<br \/>\n\u3053\u308c\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u7d42\u4e86\uff0e<br \/>\n&nbsp;<\/p>\n<h3>Hands On OpenCL<\/h3>\n<p><a href=\"https:\/\/www.khronos.org\/developers\/training\/\">OpenCL\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30b3\u30fc\u30b9<\/a>\u306fKhronos Technologies\u306e\u30da\u30fc\u30b8\u3067\u7d39\u4ecb\u3055\u308c\u3066\u304a\u308a\uff0c\u69d8\u3005\u306a\u3082\u306e\u304c\u3042\u308b\uff0e<br \/>\n<a href=\"http:\/\/handsonopencl.github.io\/\">Hands On OpenCL<\/a>\u306f\u305d\u306e\u4e2d\u306e\u3072\u3068\u3064\u3067\uff0c\u30a4\u30ae\u30ea\u30b9\u306eBristol\u5927\u5b66\u306e\u6559\u54e1\u304c2\u65e5\u9593\u306e\u8b1b\u7fa9\u30b3\u30fc\u30b9\u306e\u305f\u3081\u306b\u4f5c\u6210\u3057\u305f\u8cc7\u6599\u3068\u306a\u3063\u3066\u3044\u308b\uff0e<br \/>\nOpenCL\u306b\u3064\u3044\u3066\u7406\u89e3\u3057\u3084\u3059\u304f\uff0c<a href=\"https:\/\/github.com\/HandsOnOpenCL\/Lecture-Slides\/releases\">\u30b9\u30e9\u30a4\u30c9<\/a>\u3068<a href=\"https:\/\/github.com\/HandsOnOpenCL\/Exercises-Solutions\">\u6f14\u7fd2\u30fb\u89e3\u6cd5<\/a>\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u305f\u3081\uff0c\u4eca\u56de\u306f\u3053\u308c\u3092\u4f7f\u3063\u3066\u307f\u308b\uff0e<\/p>\n<pre class=\"lang:default decode:true\">git clone git:\/\/github.com\/HandsOnOpenCL\/Exercises-Solutions.git<\/pre>\n<p>\u3068\u3057\u3066\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30af\u30ed\u30fc\u30f3\u3059\u308b\uff0e<br \/>\nExercise01\u306bDeviceInfo\u3068\u3044\u3046\uff0c\u74b0\u5883\u3092\u78ba\u8a8d\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3042\u308b\u305f\u3081\uff0c\u3053\u308c\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\uff0e<\/p>\n<pre class=\"lang:sh decode:true\">root@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C# pwd\n\/root\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C\nroot@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C# make\ncc DeviceInfo.c -std=c99 -lOpenCL -I ..\/..\/C_common -o DeviceInfo\nroot@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C# ls\nDeviceInfo DeviceInfo.c Makefile\nroot@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C# .\/DeviceInfo\nNumber of OpenCL platforms: 1\n-------------------------\nPlatform: OpenCL for the Raspberry Pi VideoCore IV GPU\nVendor: doe300\nVersion: OpenCL 1.2 VC4CL 0.4\nNumber of devices: 1\n-------------------------\nName: VideoCore IV GPU\nVersion: OpenCL C 1.2\nMax. Compute Units: 1\nLocal Memory Size: 65536 KB\nGlobal Memory Size: 64 MB\nMax Alloc Size: 64 MB\nMax Work-group Total Size: 12\nMax Work-group Dims: ( 12 12 12 )\n-------------------------\n-------------------------\nroot@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise01\/C#\n<\/pre>\n<p>\u3069\u3046\u3084\u3089\u74b0\u5883\u8a2d\u5b9a\u306f\u3046\u307e\u304f\u3044\u3063\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u308b\uff0e<br \/>\n\u6b21\u306bExercises02\u3067\u306f\u30d9\u30af\u30c8\u30eb\u306e\u52a0\u7b97\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3042\u308b\u305f\u3081\uff0cmake\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u308b\uff0e<\/p>\n<pre class=\"lang:sh decode:true \">root@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Exercises\/Exercise02\/C# .\/vadd\nDevice is VideoCore IV GPU GPU from Broadcom with a max of 1 compute units\nThe kernel ran in 0.002553 seconds\nC = A+B: 1024 out of 1024 results were correct.<\/pre>\n<p>\u3053\u308c\u3082\u52d5\u4f5c\u3057\u3066\u3044\u308b\uff0e<br \/>\n\u3067\uff0c\u3069\u308c\u304f\u3089\u3044\u9ad8\u901f\u5316\u3067\u304d\u308b\u306e\u304b\u306b\u3064\u3044\u3066\uff0cSolutions\u306e\u65b9\u306eExercise06\u3092\u5b9f\u884c\u3057\u305f\uff0e<\/p>\n<pre class=\"lang:sh decode:true \">root@BLUEDOG:~\/vc4cl\/Exercises-Solutions\/Solutions\/Exercise06\/C# .\/mult\nUsing OpenCL device: VideoCore IV GPU\n===== Sequential, matrix mult (dot prod), order 1024 on host CPU ======\n383.08 seconds at 5.6 MFLOPS\n===== OpenCL, matrix mult, C(i,j) per work item, order 1024 ======\n216.92 seconds at 9.9 MFLOPS<\/pre>\n<p>1.77\u500d\u7a0b\u5ea6\u306e\u9ad8\u901f\u5316\u3092\u884c\u3048\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308b\uff0e<br \/>\n&nbsp;<\/p>\n<h3>\u305d\u306e\u5f8c<\/h3>\n<p>\u4eca\u306f<a href=\"https:\/\/github.com\/HandsOnOpenCL\/Lecture-Slides\/releases\">\u30b9\u30e9\u30a4\u30c9<\/a>\u3092\u898b\u3064\u3064\u6f14\u7fd2\u3092\u9032\u3081\u3066\u3044\u308b\uff0e<br \/>\n\u66f8\u7c4d\u3084<a href=\"https:\/\/www.khronos.org\/developers\/training\/\">\u4ed6\u306e\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0<\/a>\u3082\u53c2\u8003\u306b\u306a\u308b\uff0e<br \/>\n\u3042\u308b\u7a0b\u5ea6\u7406\u89e3\u3057\u305f\u3089FPGA\u306e\u65b9\u306eOpenCL\u3092\u3084\u3063\u3066\u307f\u308b\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FPGA\u3067OpenCL\u3092\u89e6\u3063\u3066\u307f\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u3066\uff0c\u3067\u3082FPGA\u306f\u7279\u6b8a\u306a\u306e\u3067\uff0c\u524d\u6bb5\u968e\u3068\u3057\u3066Raspberry Pi\u3067OpenCL\u3092\u89e6\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\uff0e \u4eca\u56de\u306f\u79c1\u304c\u6240\u6301\u3057\u3066\u3044\u308bRaspberryPi2B\u3067\u8a71\u3092\u9032\u3081\u308b\u304c\uff0cGP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-615","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts\/615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/comments?post=615"}],"version-history":[{"count":0,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts\/615\/revisions"}],"wp:attachment":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/media?parent=615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/categories?post=615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/tags?post=615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}