Library/ManagedCuda/CudaKernel.cs
/// <summary>
/// Set the constant variable <c>name</c> to value <c>value</c><para>The constant variable must be defined in the CUDA module.</para>
/// </summary>
/// <param name="name">constant variable name</param>
/// <param name="value">value</param>
Set the constant variable namevalueThe constant variable must be defined in the CUDA module.
Set the constant variable namevalueThe constant variable must be defined in the CUDA module .
public void SetConstantVariable(string name, uchar3[] value)
		{
			CUdeviceptr dVarPtr = new CUdeviceptr();
			SizeT varSize = 0;
			res = DriverAPINativeMethods.ModuleManagement.cuModuleGetGlobal_v2(ref dVarPtr, ref varSize, _module, name);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Kernel: {3}", DateTime.Now, "cuModuleGetGlobal", res, _kernelName));   
			if (res != CUResult.Success) throw new CudaException(res);
			res = DriverAPINativeMethods.SynchronousMemcpy_v2.cuMemcpyHtoD_v2(dVarPtr, value, varSize);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Kernel: {3}", DateTime.Now, "cuMemcpyHtoD", res, _kernelName));   
			if (res != CUResult.Success) throw new CudaException(res);
		}
public void SetConstantVariable ( string name , uchar3 [ ] value ) { CUdeviceptr dVarPtr = new CUdeviceptr ( ) ; SizeT varSize = 0 ; res = DriverAPINativeMethods . ModuleManagement . cuModuleGetGlobal_v2 ( ref dVarPtr , ref varSize , _module , name ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res , _kernelName ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; res = DriverAPINativeMethods . SynchronousMemcpy_v2 . cuMemcpyHtoD_v2 ( dVarPtr , value , varSize ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res , _kernelName ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; }
Set the constant variable namevalueThe constant variable must be defined in the CUDA module.
Set the constant variable namevalueThe constant variable must be defined in the CUDA module .
name
string
constant variable name
constant variable name
value
uchar3[]
None