我希望先声明,我对OpenCL/GPU编程一无所知,但我是一名高级C#(一般 .Net)程序员,不怕C++,并且我想学习OpenCL/GPU编程...我的问题是...我应该从哪里开始?!? 我应该下载什么?!?是否有一种方法可以在Visual Studio(用C#)上编写OpenCL/GPU代码?!?例如...hello world之类的东西...谢谢大家
我希望先声明,我对OpenCL/GPU编程一无所知,但我是一名高级C#(一般 .Net)程序员,不怕C++,并且我想学习OpenCL/GPU编程...我的问题是...我应该从哪里开始?!? 我应该下载什么?!?是否有一种方法可以在Visual Studio(用C#)上编写OpenCL/GPU代码?!?例如...hello world之类的东西...谢谢大家
http://www.macresearch.org/opencl
尽管这些视频展示的是NVIDIA风格的卡,但以下重要概念同样适用于AMD或NVIDIA,并且对于开始改变您算法结构以获得GPU性能提升至关重要:许多线程以锁步方式运行相同的指令(即使某些代码使用if-else结构),以及
合并内存访问
请注意,不要修改原文中的解释和HTML标签。
http://developer.amd.com/zones/OpenCLZone/pages/default.aspx
假设您想进行OpenCL而不是CUDA编程,那么这里有一整套入门视频教程。NVidia也有类似的教程,但它们更多基于CUDA。https://github.com/tugrul512bit/Cekirdekler/wiki/Beginning
"以传统的方式输出“Hello World”:"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);
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
-----------------------------------------------------------------------------------------------------------------