I am trying to set the simulation parameters in read only memory, but without luck (CUDA.NET). The cudaMemcpyToSymbol function returns cudaErrorInvalidSymbol. The first parameter in cudaMemcpyToSymbol is the string ... Is this the name of the character? In fact, I do not understand how this can be solved. Any help was appreciated.
//init, load .cubin float[] arr = new float[1]; arr[0] = 0.0f; int size = Marshal.SizeOf(arr[0]) * arr.Length; IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.Copy(arr, 0, ptr, arr.Length); var error = CUDARuntime.cudaMemcpyToSymbol("param", ptr, 4, 0, cudaMemcpyKind.cudaMemcpyHostToDevice);
My .cu file contains
__constant__ float param;
Working solution
cuda.LoadModule(Path.Combine(Environment.CurrentDirectory, "name.cubin")); simParams = cuda.GetModuleGlobal("params"); float[] parameters = new float[N]{...} cuda.CopyHostToDevice<float>(simParams, parameters);
source share