Hi, I’m new to CUDA programming, and I’d like to get some help to make a program that would take an array, modify it and return it back to host.
public static CUDA cuda; public static CUfunction myFunction; int myArray = new int; myArray = 10; myArray = 20; myArray = 30; myArray = 40; cuda = new CUDA(0, true); cuda.LoadModule("test.cubin"); myFunction = cuda.GetModuleFunction("myFunction"); CUdeviceptr dpt = cuda.CopyHostToDevice<int>(myArray); cuda.SetParameter(myFunction, 0, myArray); cuda.Launch(myFunction); cuda.CopyDeviceToHost<int>(dpt, myArray); /* I'd like the CUDA program to add 10 to every item in the array, so i would get myArray = 20, myArray = 30, etc */
Wouldn’t the C# code be something like this?
Thanks in advance! :">