Concurrent programming in OpenCL vs Grand Central Dispatch

With the introduction of OpenCL 2.0, OpenCL seems to have many Grand Central Dispatch (GCD) features, such as CLang / Apple style blocks and queues. Looking at their respective feature sets, I wonder if OpenCL can do everything GCD / libdispatch can do, but with the added ability to direct computations to the GPU as well as to the processor - or if GCD can offer more, which is separate from OpenCL.

In particular, my questions are:

  • What distinguishes concurrency from GCD and OpenCL?

  • If it makes sense to use them together (provided that GCD offers additional features), can C-blocks be redirected either to the GCD queue or to the OpenCL queue? And if targeting the CPU, will there be a reason to go through OpenCL vs direct execution

  • Does OpenCL 2.0 support GCD-style load balancing that can fill threads spanning both the processor and GPU?

+4
source share
3 answers

In its current form, OpenCL is able to solve both parallel parallel parallel parallel tasks and proofs of various OpenCL API primitives for working in a queue:

  • clEnqueuNDRangeKernel: Used to host a kernel with the size of an N-dimensional workgroup. Commonly used for parallel data processing.
  • clEnqueueTask: , . , , clEnqueueNDRangeKernel 1. OpenCL 2.0
  • clEnqueueNativeKernel C/++ ( ), , ( ), OpenCL . , .

, OpenCL - , - 1, 2 , . , , , DSP , OpenCL .

GCD, , , , ( ). GCD .

, OpenCL GCD ( , Apple), . "" .

OS X 10.7 GCD OpenCL ( ) , OpenCL, / OpenCL GCD.

/ w.r.t. :

1 - concurrency GCD OpenCL?

@Dithermaster @sharpneli, GCD ( ) , OpenCL .

OpenCL GCD . , OpenCL GCD , GCD . runtime OpenCL ( , , ).

GCD , , , GCD , .

. OpenCL , , . GCD .

, OpenCL , SIMD . , (, MIC) .

- concurrency, - OpenCL , , . , .

2 - ( , GCD ), C- GCD, OpenCL? CPU, OpenCL vs

GCD OpenCL , , OpenCL. , , , GCD . , API OpenCL C ( API ++), , .

, GCD gcl_get_kernel_block_workgroup_info, .

, , C GCD OpenCL. C- -OpenCL-. OpenCL ( ) , OpenCL. ( OpenCL) .

3. OpenCL 2.0 GCD, , , ?

, OpenCL 2.0 , , , .

, CPU, GPU. - , . .

, OpenCL 2.0, , parallelism . , GCD.

+4

1) . OpenCL - , . GCD - , IO -. - OpenCL.

2) , OpenCL CPU. Intel OpenCL , ​​ 8 ( "" SSE).

C- OpenCL. ​​ . OpenCL - , . , Clang IR, - . - OpenCL.

3) . , . GDC Intel ( ).

OpenCL2.0 , HW , HW ​​ . .

+1

"OpenCL has vector data types and vector built-in functions that allow you to directly reference the potential of SIMD architecture without using a compiler" - Erik Duymelinck

Apple introduced for iOS 8 and OS X Yosemite

  • 2D, 3D, 4D Vector mach and geometry.
  • Featues of Metal in C, Obj-C and C ++ on the processor
  • Abstraction on SIMD architecture-specific types and internal capabilities.
+1
source

Source: https://habr.com/ru/post/1524885/


All Articles