public static Context CreateContext(Platform platform, Device[] devices, ContextNotify callback, object userData) { var pty = platform != null ? new ContextProperty[] { new ContextProperty(ContextProperties.Platform, platform.handle), ContextProperty.Zero } : null; var num = devices.Length; var dev = new IntPtr[num]; for (var i = 0; i < num; i++) { dev[i] = devices[i].handle; } var pfn = (ContextNotifyData)null; var pcb = (ContextNotifyInternal)null; var ptr = IntPtr.Zero; if (callback != null) { pfn = new ContextNotifyData(callback, userData); pcb = ContextNotifyData.Callback; ptr = pfn.Handle; } var err = ErrorCode.Success; var ctx = NativeMethods.clCreateContext(pty, (uint)num, dev, pcb, ptr, out err); if (err != ErrorCode.Success) { throw new OpenClException(err); } return(new Context(ctx, pfn)); }
public static ContextHandle CreateContextFromType(ContextProperty[] properties, DeviceType deviceType, ContextNotify pfnNotify, IntPtr userData, out OpenCLErrorCode errcodeRet) { return new ContextHandle(clCreateContextFromType(properties, deviceType, pfnNotify, userData, out errcodeRet)); }
public static ContextHandle CreateContext(ContextProperty[] properties, uint numDevices, DeviceHandle[] devices, ContextNotify pfnNotify, IntPtr userData, out OpenCLErrorCode errcodeRet) { return new ContextHandle(clCreateContext(properties, numDevices, devices, pfnNotify, userData, out errcodeRet)); }
public Context CreateContext(IntPtr[] contextProperties, Device[] devices, ContextNotify notify, IntPtr userData) { IntPtr contextID; ErrorCode result; IntPtr[] deviceIDs = InteropTools.ConvertDevicesToDeviceIDs(devices); contextID = (IntPtr)OpenCL.CreateContext(contextProperties, (uint)deviceIDs.Length, deviceIDs, notify, userData, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContext failed with error code: " + result, result); } return(new Context(this, contextID)); }
public Context CreateDefaultContext(ContextNotify notify, IntPtr userData) { var properties = new[] { new IntPtr((Int64)ContextProperties.PLATFORM), this.PlatformID, IntPtr.Zero }; IntPtr contextID; ErrorCode result; contextID = OpenCL.CreateContext(properties, (UInt32)this.DeviceIDs.Length, this.DeviceIDs, notify, userData, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContext failed with error code: " + result, result); } return(new Context(this, contextID)); }
public static IntPtr CreateContextFromType(IntPtr[] properties, DeviceType device_type, ContextNotify pfn_notify, IntPtr user_data, out ErrorCode errcode_ret) { return(OpenCLAPI.clCreateContextFromType(properties, device_type, pfn_notify, user_data, out errcode_ret)); }
public Context CreateContextFromType(IntPtr[] contextProperties, DeviceType deviceType, ContextNotify notify, IntPtr userData) { IntPtr contextID; ErrorCode result; contextID = (IntPtr)OpenCL.CreateContextFromType(contextProperties, deviceType, notify, userData, out result); if (result != ErrorCode.SUCCESS) throw new OpenCLException("CreateContextFromType failed with error code: " + result, result); return new Context(this, contextID); }
/// <summary> /// Create a context and initialize default command queues in the CQ property /// </summary> /// <param name="platform"></param> /// <param name="devices"></param> public void CreateContext(Platform platform, IntPtr[] contextProperties, IEnumerable <Device> devices, ContextNotify notify, IntPtr userData) { if (!OpenCLIsAvailable) { throw new OpenCLNotAvailableException(); } Platform = platform; Context = platform.CreateContext(contextProperties, devices.ToArray <Device>(), notify, userData); CQ = new CommandQueue[Context.Devices.Length]; for (int i = 0; i < Context.Devices.Length; i++) { CQ[i] = Context.CreateCommandQueue(Context.Devices[0]); } }
private static extern IntPtr clCreateContextFromType([In] [MarshalAs(UnmanagedType.LPArray)] cl_uint[] properties, DeviceType deviceType, ContextNotify pfnNotify, IntPtr userData, [Out] [MarshalAs(UnmanagedType.I4)] out ErrorCode errcodeRet);
public static extern IntPtr CreateContext([In][MarshalAs(UnmanagedType.LPArray)] ContextProperty[] properties, uint numDevices, [In][MarshalAs(UnmanagedType.LPArray)] Device[] devices, ContextNotify pfnNotify, IntPtr userData, out ErrorCode errcodeRet);
public static extern IntPtr CreateContextFromType([In][MarshalAs(UnmanagedType.LPArray)] ContextProperty[] properties, DeviceType deviceType, ContextNotify pfnNotify, IntPtr userData, [Out][MarshalAs(UnmanagedType.I4)] out ErrorCode errcodeRet);
public Form1() { InitializeComponent(); oclContextNotify = new ContextNotify(OpenCLContextNotifyCallBack); }
internal static extern cl_context clCreateContextFromType([In] cl_context_properties[] properties, [MarshalAs(UnmanagedType.U8)] DeviceType device_type, ContextNotify pfn_notify, IntPtr user_data, [MarshalAs(UnmanagedType.I4)] out ErrorCode errcode_ret);
internal static extern cl_context clCreateContext([In] cl_context_properties[] properties, cl_uint num_devices, [In] cl_device_id[] devices, ContextNotify pfn_notify, IntPtr user_data, [MarshalAs(UnmanagedType.I4)] out ErrorCode errcode_ret);
private static extern IntPtr clCreateContext([In][MarshalAs(UnmanagedType.LPArray)] cl_uint[] properties, cl_uint numDevices, [In][MarshalAs(UnmanagedType.LPArray)] Device[] devices, ContextNotify pfnNotify, IntPtr userData, out ErrorCode errcodeRet);
private static extern IntPtr clCreateContext([In] [MarshalAs(UnmanagedType.LPArray)] cl_uint[] properties, cl_uint numDevices, [In] [MarshalAs(UnmanagedType.LPArray)] Device[] devices, ContextNotify pfnNotify, IntPtr userData, out ErrorCode errcodeRet);
/// <summary> /// Create a context and initialize default command queues in the CQ property /// </summary> /// <param name="platform"></param> /// <param name="devices"></param> public void CreateContext(Platform platform, IntPtr[] contextProperties, IEnumerable <Device> devices, ContextNotify notify, IntPtr userData) { if (!this.OpenCLIsAvailable) { throw new OpenCLNotAvailableException(); } this.Platform = platform; this.Context = platform.CreateContext(contextProperties, devices.ToArray(), notify, userData); this.CQ = new CommandQueue[this.Context.Devices.Length]; for (var i = 0; i < this.Context.Devices.Length; i++) { this.CQ[i] = this.Context.CreateCommandQueue(this.Context.Devices[0]); } }
public static IntPtr CreateContext(IntPtr[] properties, uint num_devices, IntPtr[] devices, ContextNotify pfn_notify, IntPtr user_data, out ErrorCode errcode_ret) { return OpenCLAPI.clCreateContext(properties, num_devices, devices, pfn_notify, user_data, out errcode_ret); }
public ContextNotifyData(ContextNotify callback, object data) { this.callback = callback; this.data = data; this.handle = GCHandle.Alloc(this, GCHandleType.Normal); }
public static IntPtr CreateContextFromType(IntPtr[] properties, DeviceType device_type, ContextNotify pfn_notify, IntPtr user_data, out ErrorCode errcode_ret) { return OpenCLAPI.clCreateContextFromType(properties, device_type, pfn_notify, user_data, out errcode_ret); }
public static Context CreateContextFromType(Platform platform, DeviceType type, ContextNotify callback, object userData) { var pty = platform != null ? new ContextProperty[] { new ContextProperty(ContextProperties.Platform, platform.handle), ContextProperty.Zero } : null; var pfn = (ContextNotifyData)null; var pcb = (ContextNotifyInternal)null; var ptr = IntPtr.Zero; if (callback != null) { pfn = new ContextNotifyData(callback, userData); pcb = ContextNotifyData.Callback; ptr = pfn.Handle; } var err = ErrorCode.Success; var ctx = NativeMethods.clCreateContextFromType(pty, type, pcb, ptr, out err); if (err != ErrorCode.Success) { throw new OpenClException(err); } return(new Context(ctx, pfn)); }
public static extern IntPtr CreateContextFromType([In][MarshalAs(UnmanagedType.LPArray)] void *properties, ulong deviceType, ContextNotify pfnNotify, IntPtr userData, [Out][MarshalAs(UnmanagedType.I4)] out int errcodeRet);
public Context CreateContext(IntPtr[] contextProperties, Device[] devices, ContextNotify notify, IntPtr userData) { IntPtr contextID; ErrorCode result; IntPtr[] deviceIDs = InteropTools.ConvertDevicesToDeviceIDs(devices); contextID = (IntPtr)OpenCL.CreateContext(contextProperties, (uint)deviceIDs.Length, deviceIDs, notify, userData, out result); if (result != ErrorCode.SUCCESS) throw new OpenCLException("CreateContext failed with error code: " + result, result); return new Context(this, contextID); }
public static extern IntPtr CreateContext([In][MarshalAs(UnmanagedType.LPArray)] void *properties, uint numDevices, [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] IntPtr[] devices, ContextNotify pfnNotify, IntPtr userData, out int errcodeRet);
public Context CreateDefaultContext( ContextNotify notify, IntPtr userData ) { IntPtr[] properties = new IntPtr[] { new IntPtr((long)ContextProperties.PLATFORM), PlatformID, IntPtr.Zero, }; IntPtr contextID; ErrorCode result; contextID = (IntPtr)OpenCL.CreateContext( properties, (uint)DeviceIDs.Length, DeviceIDs, notify, userData, out result ); if( result!=ErrorCode.SUCCESS ) throw new OpenCLException( "CreateContext failed with error code: "+result, result); return new Context( this, contextID ); }
/// <summary> /// Create a context and initialize default command queues in the CQ property /// </summary> /// <param name="platform"></param> /// <param name="devices"></param> public void CreateContext( Platform platform, IntPtr[] contextProperties, IEnumerable<Device> devices, ContextNotify notify, IntPtr userData ) { if (!OpenCLIsAvailable) throw new OpenCLNotAvailableException(); Platform = platform; Context = platform.CreateContext( contextProperties, devices.ToArray<Device>(), notify, userData ); CQ = new CommandQueue[Context.Devices.Length]; for (int i = 0; i < Context.Devices.Length; i++) CQ[i] = Context.CreateCommandQueue(Context.Devices[0]); }
public Context CreateContextFromType(IntPtr[] contextProperties, DeviceType deviceType, ContextNotify notify, IntPtr userData) { IntPtr contextID; ErrorCode result; contextID = (IntPtr)OpenCL.CreateContextFromType(contextProperties, deviceType, notify, userData, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContextFromType failed with error code: " + result, result); } return(new Context(this, contextID)); }
public static IntPtr CreateContext(IntPtr[] properties, uint num_devices, IntPtr[] devices, ContextNotify pfn_notify, IntPtr user_data, out ErrorCode errcode_ret) { return(OpenCLAPI.clCreateContext(properties, num_devices, devices, pfn_notify, user_data, out errcode_ret)); }