Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCL and GPU programming Roadmap

i would like to start stating that i know nothing of OpenCL/GPU programming but i am a advanced C# (general .Net) programmer without fear of C++ and i would like to learn OpenCL/GPU programming... my question is... where do i start?!? what should i download?!? is there a way to program OpenCL/GPU on the Visual Studio (on C#)!?! like... hello world stuff... tks all

like image 561
Leonardo Avatar asked Dec 13 '10 16:12

Leonardo


People also ask

Does OpenCL run on GPU?

OpenCL™ (Open Computing Language) is a low-level API for heterogeneous computing that runs on CUDA-powered GPUs. Using the OpenCL API, developers can launch compute kernels written using a limited subset of the C programming language on a GPU.

Is OpenCL as good as CUDA?

A study that directly compared CUDA programs with OpenCL on NVIDIA GPUs showed that CUDA was 30% faster than OpenCL. OpenCL is rarely used for machine learning. As a result, the community is small, with few libraries and tutorials available.

Is OpenCL alive?

opencl by all accounts, is dead. The 6900xt only supports opencl 2.1, and nvidia cards support opencl 2.0.

Is Nvidia a CUDA or OpenCL?

CUDA and OpenCL offer two different interfaces for programming GPUs. OpenCL is an open standard that can be used to program CPUs, GPUs, and other devices from different vendors, while CUDA is specific to NVIDIA GPUs.


1 Answers

I'm sorry for being 7 years late. But here is an open source C# gpgpu library to write your own OpenCL kernels:

https://github.com/tugrul512bit/Cekirdekler/wiki/Beginning

and a hello world as tradition:

ClNumberCruncher  gpus= new ClNumberCruncher(
    ClPlatforms.all().devicesAmd().gpus(), @"
         __constant char text[12] = {'h','e','l','l','o',' ','w','o','r','l','d',' '};
         __kernel void hello(__global char * arr)
         {
              printf(text);
         }
    ");
gpus.performanceFeed = true;
ClArray<byte> array = new ClArray<byte>(5,1);
array.compute(gpus, 1, "hello", 5, 1);
array.compute(gpus, 1, "hello", 5, 1);
array.compute(gpus, 1, "hello", 5, 1);

this is the output:

hello world
hello world
hello world
hello worldhello world

Compute-ID: 1  ----- Load Distributions:  [40.0%] - [60.0%] -----------------------------------------------------
Device 0(gddr): Oland                              ||| time: 29.47ms, workitems: 2
Device 1(gddr): gfx804                             ||| time: 29.76ms, workitems: 3
-----------------------------------------------------------------------------------------------------------------

hello worldhello world
hello world
hello world
hello world

Compute-ID: 1  ----- Load Distributions:  [40.0%] - [60.0%] -----------------------------------------------------
Device 0(gddr): Oland                              ||| time: 1.64ms, workitems: 2
Device 1(gddr): gfx804                             ||| time: 1.33ms, workitems: 3
-----------------------------------------------------------------------------------------------------------------

hello worldhello world
hello world
hello world
hello world

Compute-ID: 1  ----- Load Distributions:  [40.0%] - [60.0%] -----------------------------------------------------
Device 0(gddr): Oland                              ||| time: 1.08ms, workitems: 2
Device 1(gddr): gfx804                             ||| time: .87ms, workitems: 3
-----------------------------------------------------------------------------------------------------------------

it can do a bunch of things from pipelining to task pool scheduling.

like image 72
huseyin tugrul buyukisik Avatar answered Sep 22 '22 06:09

huseyin tugrul buyukisik