Library/ManagedCuda/CudaContext.cs
/// <summary>
/// Load a ptx module from image as byte[]
/// </summary>
/// <param name="moduleImage"></param>
/// <param name="options">Collection of linker and compiler options</param>
/// <returns></returns>
Load a ptx module from image as byte[]
Load a ptx module from image as byte []
public CUmodule LoadModulePTX(byte[] moduleImage, CudaJitOptionCollection options)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUResult res;
			CUmodule hcuModule = new CUmodule();
			moduleImage = AddZeroToArray(moduleImage);
			if (options == null)
			{
				res = DriverAPINativeMethods.ModuleManagement.cuModuleLoadDataEx(ref hcuModule, moduleImage, 0, null, null);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuModuleLoadDataEx", res));
			}
			else
			{
				res = DriverAPINativeMethods.ModuleManagement.cuModuleLoadDataEx(ref hcuModule, moduleImage, (uint)options.Count, options.Options, options.Values);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuModuleLoadDataEx", res));
			}
			if (res != CUResult.Success)
				throw new CudaException(res);
			return hcuModule;
		}
public CUmodule LoadModulePTX ( byte [ ] moduleImage , CudaJitOptionCollection options ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUResult res ; CUmodule hcuModule = new CUmodule ( ) ; moduleImage = AddZeroToArray ( moduleImage ) ; if ( options == null ) { res = DriverAPINativeMethods . ModuleManagement . cuModuleLoadDataEx ( ref hcuModule , moduleImage , 0 , null , null ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; } else { res = DriverAPINativeMethods . ModuleManagement . cuModuleLoadDataEx ( ref hcuModule , moduleImage , ( uint ) options . Count , options . Options , options . Values ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; } if ( res != CUResult . Success ) throw new CudaException ( res ) ; return hcuModule ; }
Load a ptx module from image as byte[]
Load a ptx module from image as byte []
//Append zero to make image always zero terminated:
None
moduleImage
byte[]
None
options
CudaJitOptionCollection
Collection of linker and compiler options
Collection of linker and compiler options