![]() |
How to use GPU(Cuda/OpenCL) for mathematical operations - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: How to use GPU(Cuda/OpenCL) for mathematical operations (/Thread-How-to-use-GPU-Cuda-OpenCL-for-mathematical-operations) |
How to use GPU(Cuda/OpenCL) for mathematical operations - noXxio - 07-04-2013 Hey, so today I'll try to show you how to calculate mathematical operations on your GPU using Cuda(on Nvidia), or OpenCL(on Ati/Intel). We're using "Cudafy.Net" to achive this. I have made a simple Example on which you can see how it works. Download Screenshot: Spoiler: Code explanation: Our "whole" Code: PHP Code: using Cudafy; PHP Code: private void btn_gpu_en_Click(object sender, EventArgs e) and: PHP Code: [Cudafy] So the only thing I'll explain is: PHP Code: private void btn_gpu_en_Click(object sender, EventArgs e) PHP Code: CudafyModes.Target = eGPUType.OpenCL; You map the DeviceId 0, the first device. And define the Language your C# Code will be translated to OpenCL, if you are using Cuda, it should be of course translated to Cuda ![]() PHP Code: GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId); 2. Defines a new Module, in this case the Translator. 3. The in Step 1. defined Gpu Loads the in Step 2. defined Module. PHP Code: gpu.Launch().encrypt(Convert.ToInt32(numericUpDown1.Value), dev_c); 2. Extracts the Output of our Void to "c". The rest should be self explaining, if you have any Questions feel free to ask ![]() ~noXxio RE: How to use GPU(Cuda/OpenCL) for mathematical operations - Shebang - 07-04-2013 This is pretty interesting, I'd like to see a practical implementation of this in newer releases. RE: How to use GPU(Cuda/OpenCL) for mathematical operations - Wet - 07-14-2013 C# is a dear language for me. And this is a great tutorial. I knew about this, and i know it's useful, so what should i say? GJ and keep HQ work up! RE: How to use GPU(Cuda/OpenCL) for mathematical operations - noXxio - 07-23-2013 Thank you very much for replying ![]() RE: How to use GPU(Cuda/OpenCL) for mathematical operations - Platinum - 07-23-2013 Great, I will come back to this when I do some more stuff with this language. |