문제

Basically I have a school assignment in which I have to write a function which takes in an OpenCL kernel (maybe as a byte buffer, or string), compiles it, executes it, in C#. I am having trouble with the concept of writing a C# function which can compile opencl kernel. Is there an example or links which can help me understand and write the function ?

I already have Intel opencl sdk and opencl.net integrated with my Visual Studio.

도움이 되었습니까?

해결책

There are probably many ways to skin this cat, but one way is a .NET wrapper for OpenCL called cloo. I have an example project available for you to look at on my GitHub repo.

The gist is that cloo interfaces to the unmanaged OpenCL libraries. You actually write your kernel in a string, and use cloo's API to compile and execute it. Take a look at Julia.cs or Mandelbrot.cs in my repo. There are methods in each called CreateGPU which will show you how to work with the API.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top