示例#1
0
        /// <summary>
        /// OpenCL 1.1
        /// </summary>
        /// <param name="_event"></param>
        /// <param name="execution_status"></param>
        public void SetUserEventStatus(ExecutionStatus execution_status)
        {
            ErrorCode result;

            result = OpenCL.SetUserEventStatus(EventID, execution_status);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetUserEventStatus failed with error code " + result, result);
            }
        }
示例#2
0
        /// <summary>
        ///     Set argument argIndex to c
        /// </summary>
        /// <param name="argIndex"></param>
        /// <param name="c"></param>
        public void SetArg(Int32 argIndex, System.UInt16 c)
        {
            ErrorCode result;

            result = OpenCL.SetKernelArg(this.KernelID, (UInt32)argIndex, new IntPtr(sizeof(System.UInt16)), &c);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#3
0
        public void SetArg(Int32 argIndex, Double2 c)
        {
            ErrorCode result;

            result = OpenCL.SetKernelArg(this.KernelID, (UInt32)argIndex, (IntPtr)sizeof(Double2), &c);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#4
0
        public void SetByteArg(int argIndex, byte c)
        {
            ErrorCode result;

            result = (ErrorCode)OpenCL.SetKernelArg(KernelID, (uint)argIndex, new IntPtr(sizeof(byte)), &c);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#5
0
        public void RetainDeviceEXT()
        {
            ErrorCode result;

            result = OpenCL.RetainDeviceEXT(DeviceID);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("RetainDeviceEXT failed with error code: " + result, result);
            }
        }
示例#6
0
        public void SetArg(int argIndex, Double16 c)
        {
            ErrorCode result;

            result = OpenCL.SetKernelArg(KernelID, (uint)argIndex, (IntPtr)sizeof(Double16), &c);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#7
0
        public void SetArg(int argIndex, IntPtr argSize, IntPtr argValue)
        {
            ErrorCode result;

            result = (ErrorCode)OpenCL.SetKernelArg(KernelID, (uint)argIndex, argSize, argValue.ToPointer());
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#8
0
		static OpenCL() {
			try {
				OpenCL.Initialize();
			}
			catch (Exception) {
				OpenCL._Platforms.Clear();
				OpenCL.PlatformIDs = new IntPtr[0];
				OpenCL.Platforms = new Platform[0];
			}
		}
示例#9
0
        public override unsafe void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetImageInfo(MemID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                base.ReadProperty(key, keyLength, pBuffer);
            }
        }
示例#10
0
        public void ReadProperty(UInt32 key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = OpenCL.GetContextInfo(this.ContextID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetContextInfo failed: " + result, result);
            }
        }
示例#11
0
        internal IntPtr ImportFunction(string functionName)
        {
            IntPtr entryPoint;

            entryPoint = OpenCL.GetExtensionFunctionAddressForPlatform(Platform, functionName);
            if (entryPoint == IntPtr.Zero)
            {
                throw new EntryPointNotFoundException("Error when importing function \"" + functionName + "\" from the " + GetName() + " extension");
            }
            return(entryPoint);
        }
示例#12
0
        public void ReadProperty(UInt32 key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = OpenCL.GetDeviceInfo(this.DeviceID, key, keyLength, pBuffer, out size);
            if (result != (Int32)ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get device info for device " + this.DeviceID, result);
            }
        }
示例#13
0
        public void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = OpenCL.GetKernelInfo(KernelID, (uint)key, keyLength, pBuffer, out size);
            if (result != (int)ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get kernel info for kernel " + KernelID, result);
            }
        }
示例#14
0
        public void ReadProperty(UInt32 key, IntPtr keyLength, void *pBuffer)
        {
            ErrorCode result;
            IntPtr    size;

            result = OpenCL.GetProgramInfo(this.ProgramID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("clGetProgramInfo failed with error code " + result, result);
            }
        }
示例#15
0
        public void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetDeviceInfo(DeviceID, (uint)key, keyLength, pBuffer, out size);
            if (result != (int)ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get device info for device " + DeviceID, result);
            }
        }
示例#16
0
        unsafe public virtual void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetMemObjectInfo(MemID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetMemObjectInfo failed: " + result, result);
            }
        }
示例#17
0
        /// <summary>
        /// OpenCL 1.1
        /// </summary>
        /// <param name="command_exec_callback_type"></param>
        /// <param name="pfn_notify"></param>
        /// <param name="user_data"></param>
        public void SetCallback(ExecutionStatus command_exec_callback_type, EventNotify pfn_notify, object user_data)
        {
            ErrorCode result;
            int       callbackId = AddCallback(this, pfn_notify, user_data);

            result = OpenCL.SetEventCallback(EventID, (int)command_exec_callback_type, CallbackDelegate, (IntPtr)callbackId);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetEventCallback failed with error code " + result, result);
            }
        }
示例#18
0
        public void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            ErrorCode result;
            IntPtr    size;

            result = (ErrorCode)OpenCL.GetSamplerInfo(SamplerID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("clGetSamplerInfo failed with error code " + result, result);
            }
        }
示例#19
0
        public void ReadProperty(uint key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    propertySize;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetPlatformInfo(PlatformID, key, keyLength, (void *)pBuffer, out propertySize);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get platform info for platform " + PlatformID + ": " + result, result);
            }
        }
示例#20
0
        /// <summary>
        /// Returns the specified profiling counter
        /// </summary>
        /// <param name="paramName"></param>
        /// <param name="paramValue"></param>
        public unsafe void GetEventProfilingInfo(ProfilingInfo paramName, out ulong paramValue)
        {
            IntPtr paramValueSizeRet;
            ulong v;
            ErrorCode errorCode;

            errorCode = OpenCL.GetEventProfilingInfo(EventID, paramName, (IntPtr)sizeof(ulong), &v, out paramValueSizeRet);
            if (errorCode != ErrorCode.SUCCESS)
                throw new OpenCLException("GetEventProfilingInfo failed with error code "+errorCode, errorCode );
            paramValue = v;
        }
示例#21
0
        public override void ReadProperty(UInt32 key, IntPtr keyLength, void *pBuffer)
        {
            IntPtr    size;
            ErrorCode result;

            result = OpenCL.GetImageInfo(this.MemID, key, keyLength, pBuffer, out size);
            if (result != ErrorCode.SUCCESS)
            {
                base.ReadProperty(key, keyLength, pBuffer);
            }
        }
示例#22
0
文件: Kernel.cs 项目: xgalv/Cryptool2
        /// <summary>
        /// Set argument argIndex to c
        /// </summary>
        /// <param name="argIndex"></param>
        /// <param name="c"></param>
        public void SetArg(int argIndex, IntPtr c)
        {
            ErrorCode result;
            IntPtr    lc = c;

            result = (ErrorCode)OpenCL.SetKernelArg(KernelID, (uint)argIndex, (IntPtr)sizeof(IntPtr), &lc);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("SetArg failed with error code " + result, result);
            }
        }
示例#23
0
        public IntPtr GetPropertySize(uint key)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetDeviceInfo(DeviceID, key, IntPtr.Zero, null, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get device info for device " + DeviceID, result);
            }
            return(size);
        }
示例#24
0
        unsafe public virtual IntPtr GetPropertySize(uint key)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetMemObjectInfo(MemID, key, IntPtr.Zero, null, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetMemObjectInfo failed: " + result, result);
            }
            return(size);
        }
示例#25
0
        public IntPtr GetPropertySize(uint key)
        {
            IntPtr    propertySize;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetPlatformInfo(PlatformID, key, IntPtr.Zero, null, out propertySize);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get platform info for platform " + PlatformID + ": " + result, result);
            }
            return(propertySize);
        }
示例#26
0
文件: Kernel.cs 项目: xgalv/Cryptool2
        public IntPtr GetPropertySize(uint key)
        {
            IntPtr    size;
            ErrorCode result;

            result = (ErrorCode)OpenCL.GetKernelInfo(KernelID, key, IntPtr.Zero, null, out size);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("Unable to get kernel info for kernel " + KernelID, result);
            }
            return(size);
        }
示例#27
0
            public IntPtr GetPropertySize(uint key)
            {
                IntPtr    size;
                ErrorCode result = OpenCL.GetProgramBuildInfo(Program.ProgramID, Device.DeviceID, key, IntPtr.Zero, null, out size);;

                if (result != ErrorCode.SUCCESS)
                {
                    throw new OpenCLException("clGetProgramBuildInfo failed with error code " + result, result);
                }

                return(size);
            }
示例#28
0
        public Kernel CreateKernel(string kernelName)
        {
            IntPtr    kernelID;
            ErrorCode result;

            kernelID = OpenCL.CreateKernel(ProgramID, kernelName, out result);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("CreateKernel failed with error code " + result, result);
            }
            return(new Kernel(Context, this, kernelID));
        }
示例#29
0
        // Override the IPropertyContainer interface of the Mem class.

        #region IPropertyContainer Members
        public override IntPtr GetPropertySize(UInt32 key)
        {
            IntPtr    size;
            ErrorCode result;

            result = OpenCL.GetImageInfo(this.MemID, key, IntPtr.Zero, null, out size);
            if (result != ErrorCode.SUCCESS)
            {
                size = base.GetPropertySize(key);
            }
            return(size);
        }
示例#30
0
        /// <summary>
        /// OpenCL 1.1
        /// </summary>
        /// <returns></returns>
        public Event CreateUserEvent()
        {
            ErrorCode result;
            IntPtr    eventID;

            eventID = OpenCL.CreateUserEvent(ContextID, out result);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("CreateUserEvent failed with error code " + result, result);
            }
            return(new Event(this, null, eventID));
        }