作者leoloveivy (cried)
看板C_and_CPP
標題[問題] OpenCL請教
時間Wed Jul 15 19:11:17 2015
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VS2012
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenCL OpenCV
問題(Question):
BGR_image => GRAY_image
基本平行處理程式寫法
由於在GPU寫程式
我轉灰階方法去掉浮點數運算
不知道這樣可不可以加速及解決精度問題
以及kernel如何改善
餵入的資料(Input):
high resolution image 4K 8K 16K image
http://imgur.com/LxtoRvA
預期的正確結果(Expected Output):
http://imgur.com/y2A7Jfa
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
host
http://ideone.com/hbnwdB
kernel
http://ideone.com/PRZSA6
補充說明(Supplement):
這是我現在大概了解的寫法
http://imgur.com/N7GyP7v
但我想學習以下
http://imgur.com/BsKFm6d
像區塊的平行運算 因為對於我學習影像處理
希望有人可以請教交流
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.134.37.147
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1436958681.A.41D.html
→ Feis: 去掉浮點運算會加速? 這蠻神秘的. 可能我太久沒寫 GPU 07/15 19:19
→ Feis: 如果兩年前的經驗還有用的話. 你就是一個 kernel 多做點事 07/15 19:20
→ Feis: 一個算十個 pixel 之類的. 07/15 19:21
→ Feis: 事實上可能一個算百個以上會比較划算 (? 07/15 19:21
Sorry 有點筆誤 我想做的是減少浮點數運算錯誤
※ 編輯: leoloveivy (140.134.37.147), 07/15/2015 19:40:46
→ johnjohnlin: 反正是 memory bound,隨便寫都會頂到最高效率 07/16 09:26
推 mike0227: 找個filter的範例來寫吧 才會用到local memory 07/17 03:45
→ mike0227: 還有GPU上通常用float算都比int快 07/17 03:46
推 s86097john: 關於你想學的第二種方法,可以嘗試用在kernel code那 07/25 14:59
→ s86097john: 用read_image 還有write_image的opencl kernel 07/25 15:00
→ s86097john: built-in function 去實作,當然agent code那邊也要做 07/25 15:01
→ s86097john: 相對應的修改,你可以google "image object" "opencl" 07/25 15:03