Use CUDA for C# language
First you
should check your machine is compatible for CUDA. CUDA is need a NVIDIA graphic
card. To check that go to “Control Panel\System and Security\System” and open
Device Manager. Under Device Manager there is a entry called Display adapters
expand it and find your graphic card details. There are some CUDA capable GPUs
in that link. https://developer.nvidia.com/cuda-gpus
To run CUDA
program use Visual Studio 2012 or 2013.
You have to make sure that restart your machine after Install the NVIDIA
CUDA toolkit.
After this
you can test a sample code of CUDA C and verify the CUDA C is working properly in
your machine. After you install the NVIDIA CUDA Toolkit, there is some sample
codes to test your machine.
Path of the sample code: “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0
<category>\name of the sample”
<category>\name of the sample”
Before going
to the CUDA C# you have to add the bellow paths to environment variables and
make sure that in VC folder have ‘’cl.exe” file.
"C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC
"C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\bin
"C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amb64
Then create
new C# project in Visual Studio, and install the CUDAfy wrapper. To do this
follow the instruction given below.First click the PROJECT tab and click “Manage
NuGet Packages..”. Then open a window and search for cudafy. So you have
display CUDAfy.NET SDK file. Install it.
Figure 1:Installing CUDAfy.NET SDK |
Then you are
done. Now you can run a CUDAfy project. After you install CUDAfy wrapper, it
creates a folder called “Readme” in solution Explorer. Open the
example_source_code.cs.txt and copy the content in the file and copy into your
class file(.cs file). Then you can build and run.
Comments
Post a Comment