예제 #1
0
 /// <summary>
 /// Cloo compute command queue
 /// </summary>
 /// <param name="context">command context</param>
 /// <param name="device">command device</param>
 /// <param name="flags">command queue flags</param>
 public ClooCommandQueue(ClooContext context, ClooDevice device, ComputeCommandQueueFlags flags)
     : base(context, device, flags)
 {
     _context = context;
     _device = device;
     _flags = flags;
 }
예제 #2
0
        internal ComputeDevice(ComputePlatform platform, CLDeviceHandle handle)
        {
            Handle = handle;
            SetID(Handle.Value);

            addressBits            = GetInfo <uint>(ComputeDeviceInfo.AddressBits);
            available              = GetBoolInfo(ComputeDeviceInfo.Available);
            compilerAvailable      = GetBoolInfo(ComputeDeviceInfo.CompilerAvailable);
            driverVersion          = GetStringInfo(ComputeDeviceInfo.DriverVersion);
            endianLittle           = GetBoolInfo(ComputeDeviceInfo.EndianLittle);
            errorCorrectionSupport = GetBoolInfo(ComputeDeviceInfo.ErrorCorrectionSupport);
            executionCapabilities  = (ComputeDeviceExecutionCapabilities)GetInfo <long>(ComputeDeviceInfo.ExecutionCapabilities);

            string extensionString = GetStringInfo(ComputeDeviceInfo.Extensions);

            extensions = new ReadOnlyCollection <string>(extensionString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

            globalMemoryCachelineSize = GetInfo <uint>(ComputeDeviceInfo.GlobalMemoryCachelineSize);
            globalMemoryCacheSize     = (long)GetInfo <ulong>(ComputeDeviceInfo.GlobalMemoryCacheSize);
            globalMemoryCacheType     = (ComputeDeviceMemoryCacheType)GetInfo <long>(ComputeDeviceInfo.GlobalMemoryCacheType);
            globalMemorySize          = (long)GetInfo <ulong>(ComputeDeviceInfo.GlobalMemorySize);
            image2DMaxHeight          = (long)GetInfo <IntPtr>(ComputeDeviceInfo.Image2DMaxHeight);
            image2DMaxWidth           = (long)GetInfo <IntPtr>(ComputeDeviceInfo.Image2DMaxWidth);
            image3DMaxDepth           = (long)GetInfo <IntPtr>(ComputeDeviceInfo.Image3DMaxDepth);
            image3DMaxHeight          = (long)GetInfo <IntPtr>(ComputeDeviceInfo.Image3DMaxHeight);
            image3DMaxWidth           = (long)GetInfo <IntPtr>(ComputeDeviceInfo.Image3DMaxWidth);
            imageSupport          = GetBoolInfo(ComputeDeviceInfo.ImageSupport);
            localMemorySize       = (long)GetInfo <ulong>(ComputeDeviceInfo.LocalMemorySize);
            localMemoryType       = (ComputeDeviceLocalMemoryType)GetInfo <long>(ComputeDeviceInfo.LocalMemoryType);
            maxClockFrequency     = GetInfo <uint>(ComputeDeviceInfo.MaxClockFrequency);
            maxComputeUnits       = GetInfo <uint>(ComputeDeviceInfo.MaxComputeUnits);
            maxConstantArguments  = GetInfo <uint>(ComputeDeviceInfo.MaxConstantArguments);
            maxConstantBufferSize = (long)GetInfo <ulong>(ComputeDeviceInfo.MaxConstantBufferSize);
            maxMemAllocSize       = (long)GetInfo <ulong>(ComputeDeviceInfo.MaxMemoryAllocationSize);
            maxParameterSize      = (long)GetInfo <IntPtr>(ComputeDeviceInfo.MaxParameterSize);
            maxReadImageArgs      = GetInfo <uint>(ComputeDeviceInfo.MaxReadImageArguments);
            maxSamplers           = GetInfo <uint>(ComputeDeviceInfo.MaxSamplers);
            maxWorkGroupSize      = (long)GetInfo <IntPtr>(ComputeDeviceInfo.MaxWorkGroupSize);
            maxWorkItemDimensions = GetInfo <uint>(ComputeDeviceInfo.MaxWorkItemDimensions);
            maxWorkItemSizes      = new ReadOnlyCollection <long>(ComputeTools.ConvertArray(GetArrayInfo <CLDeviceHandle, ComputeDeviceInfo, IntPtr>(Handle, ComputeDeviceInfo.MaxWorkItemSizes, CL10.GetDeviceInfo)));
            maxWriteImageArgs     = GetInfo <uint>(ComputeDeviceInfo.MaxWriteImageArguments);
            memBaseAddrAlign      = GetInfo <uint>(ComputeDeviceInfo.MemoryBaseAddressAlignment);
            minDataTypeAlignSize  = GetInfo <uint>(ComputeDeviceInfo.MinDataTypeAlignmentSize);
            name                      = GetStringInfo(ComputeDeviceInfo.Name);
            this.platform             = platform;
            preferredVectorWidthChar  = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthChar);
            preferredVectorWidthFloat = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthFloat);
            preferredVectorWidthInt   = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthInt);
            preferredVectorWidthLong  = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthLong);
            preferredVectorWidthShort = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthShort);
            profile                   = GetStringInfo(ComputeDeviceInfo.Profile);
            profilingTimerResolution  = (long)GetInfo <IntPtr>(ComputeDeviceInfo.ProfilingTimerResolution);
            queueProperties           = (ComputeCommandQueueFlags)GetInfo <long>(ComputeDeviceInfo.CommandQueueProperties);
            singleCapabilities        = (ComputeDeviceSingleCapabilities)GetInfo <long>(ComputeDeviceInfo.SingleFPConfig);
            type                      = (ComputeDeviceTypes)GetInfo <long>(ComputeDeviceInfo.Type);
            vendor                    = GetStringInfo(ComputeDeviceInfo.Vendor);
            vendorId                  = GetInfo <uint>(ComputeDeviceInfo.VendorId);
            version                   = GetStringInfo(ComputeDeviceInfo.Version);
        }
예제 #3
0
 new public static ComputeErrorCode SetCommandQueueProperty(
     CLCommandQueueHandle command_queue,
     ComputeCommandQueueFlags properties,
     [MarshalAs(UnmanagedType.Bool)] bool enable,
     out ComputeCommandQueueFlags old_properties)
 {
     //Console.WriteLine("WARNING! clSetCommandQueueProperty has been deprecated in OpenCL 1.1.");
     return(CL10.SetCommandQueueProperty(command_queue, properties, enable, out old_properties));
 }
예제 #4
0
 public new static ComputeErrorCode SetCommandQueueProperty(
     CLCommandQueueHandle command_queue,
     ComputeCommandQueueFlags properties,
     [MarshalAs(UnmanagedType.Bool)] bool enable,
     out ComputeCommandQueueFlags old_properties)
 {
     RILogManager.Default?.SendTrace("WARNING! clSetCommandQueueProperty has been deprecated in OpenCL 1.1.");
     return(CL10.SetCommandQueueProperty(command_queue, properties, enable, out old_properties));
 }
        public ComputeCommandQueue(ComputeContext context, ComputeDevice device, ComputeCommandQueueFlags properties)
        {
            handle = CL10.CreateCommandQueue(context.handle, device.handle, properties, out _);

            this.device  = device;
            this.context = context;

            Events = new List <ComputeEvent>();

#if DEBUG
            Trace.WriteLine("Create " + this + " in Thread(" + Thread.CurrentThread.ManagedThreadId + ").", "Information");
#endif
        }
예제 #6
0
        /// <summary>
        /// Creates a new <see cref="ComputeCommandQueue"/>.
        /// </summary>
        /// <param name="context"> A <see cref="ComputeContext"/>. </param>
        /// <param name="device"> A <see cref="ComputeDevice"/> associated with the <paramref name="context"/>. It can either be one of <see cref="ComputeContext.Devices"/> or have the same <see cref="ComputeDeviceTypes"/> as the <paramref name="device"/> specified when the <paramref name="context"/> is created. </param>
        /// <param name="properties"> The properties for the <see cref="ComputeCommandQueue"/>. </param>
        public ComputeCommandQueue(ComputeContext context, ComputeDevice device, ComputeCommandQueueFlags properties)
        {
            ComputeErrorCode error = ComputeErrorCode.Success;

            Handle = CL10.CreateCommandQueue(context.Handle, device.Handle, properties, out error);
            ComputeException.ThrowOnError(error);

            SetID(Handle.Value);

            this.device  = device;
            this.context = context;

            outOfOrderExec = ((properties & ComputeCommandQueueFlags.OutOfOrderExecution) == ComputeCommandQueueFlags.OutOfOrderExecution);
            profiling      = ((properties & ComputeCommandQueueFlags.Profiling) == ComputeCommandQueueFlags.Profiling);

            Events = new List <ComputeEventBase>();

            Trace.WriteLine("Create " + this + " in Thread(" + Thread.CurrentThread.ManagedThreadId + ").", "Information");
        }
예제 #7
0
 new CLCommandQueueHandle CreateCommandQueue(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     Trace.WriteLine("WARNING! GetExtensionFunctionAddress has been deprecated in OpenCL 1.2.");
     return CL12.StaticCreateCommandQueue(context, device, properties, out errcode_ret);
 }
예제 #8
0
 public ComputeErrorCode SetCommandQueueProperty(CLCommandQueueHandle command_queue, ComputeCommandQueueFlags properties, [MarshalAs(UnmanagedType.Bool)] bool enable, out ComputeCommandQueueFlags old_properties)
 {
     return StaticSetCommandQueueProperty(command_queue, properties, enable, out old_properties);
 }
예제 #9
0
 public CLCommandQueueHandle CreateCommandQueueWithProperties(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     throw new NotImplementedException();
 }
예제 #10
0
파일: CL10.cs 프로젝트: yeerkkiller1/Go-AI
 public static unsafe extern ComputeErrorCode SetCommandQueueProperty(
     IntPtr command_queue,
     ComputeCommandQueueFlags properties,
     ComputeBoolean enable,
     ComputeCommandQueueFlags* old_properties);
예제 #11
0
        public static CLCommandQueueHandle CreateCommandQueuetWrapper(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties)
        {
            var handle = CreateCommandQueue(context, device, properties, out ComputeErrorCode errcode_ret);

            ComputeException.ThrowOnError(errcode_ret);
            return(handle);
        }
예제 #12
0
 CLCommandQueueHandle ICL10.CreateCommandQueue(CLContextHandle context, CLDeviceHandle device,
                                               ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return(CreateCommandQueue(context, device, properties, out errcode_ret));
 }
예제 #13
0
 /// <summary>
 /// Creates a command queue using this context and the first associated devices
 /// </summary>
 /// <param name="flags">command queue flags (default = ComputeCommandQueueFlags.None)</param>
 /// <returns>new instance of ClooCommandQueue</returns>
 /// <exception cref="InvalidOperationException">This context has no devices, cannot create ClooCommandQueue</exception>
 public ClooCommandQueue CreateCommandQueue(ComputeCommandQueueFlags flags = ComputeCommandQueueFlags.None)
 {
     if (_devices.Count <= 0) throw new InvalidOperationException("This context has no devices, cannot create ClooCommandQueue");
     return new ClooCommandQueue(this, _devices[0], flags);
 }
예제 #14
0
 public static extern CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     ComputeCommandQueueFlags properties,
     out ComputeErrorCode errcode_ret);
예제 #15
0
 public extern static ComputeErrorCode SetCommandQueueProperty(
     CLCommandQueueHandle command_queue,
     ComputeCommandQueueFlags properties,
     [MarshalAs(UnmanagedType.Bool)] bool enable,
     out ComputeCommandQueueFlags old_properties);
예제 #16
0
 ComputeErrorCode ICL10.SetCommandQueueProperty(CLCommandQueueHandle command_queue, ComputeCommandQueueFlags properties,
                                                bool enable, out ComputeCommandQueueFlags old_properties)
 {
     return(SetCommandQueueProperty(command_queue, properties, enable, out old_properties));
 }
예제 #17
0
 public new CLCommandQueueHandle CreateCommandQueueWithProperties(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return StaticCreateCommandQueueWithProperties(context, device, properties, out errcode_ret);
 }
예제 #18
0
 public ComputeCommandQueue CreateCommandQueue(ComputeCommandQueueFlags flags = ComputeCommandQueueFlags.None) =>
 new ComputeCommandQueue(Context, Device, flags);
예제 #19
0
 public static extern IntPtr CreateCommandQueue(IntPtr context, IntPtr device, ComputeCommandQueueFlags properties, out int errcode_ret);
예제 #20
0
 public CLCommandQueue(CLContext context, ComputeDevice device, ComputeCommandQueueFlags flags)
 {
     _context  = context;
     _comQueue = new ComputeCommandQueue(context._comContext, device, flags);
 }
예제 #21
0
 CLCommandQueueHandle ICL10.CreateCommandQueue(CLContextHandle context, CLDeviceHandle device,
                                               ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return CreateCommandQueue(context, device, properties, out errcode_ret);
 }
예제 #22
0
 ComputeErrorCode ICL10.SetCommandQueueProperty(CLCommandQueueHandle command_queue, ComputeCommandQueueFlags properties,
                                                bool enable, out ComputeCommandQueueFlags old_properties)
 {
     return SetCommandQueueProperty(command_queue, properties, enable, out old_properties);
 }
예제 #23
0
 public static extern ComputeErrorCode SetCommandQueueProperty(
     CLCommandQueueHandle command_queue,
     ComputeCommandQueueFlags properties,
     [MarshalAs(UnmanagedType.Bool)] bool enable,
     out ComputeCommandQueueFlags old_properties);
예제 #24
0
파일: CL11.cs 프로젝트: ddrinka/Cloo
 public static new ComputeErrorCode SetCommandQueueProperty(
     CLCommandQueueHandle command_queue,
     ComputeCommandQueueFlags properties,
     [MarshalAs(UnmanagedType.Bool)] bool enable,
     out ComputeCommandQueueFlags old_properties)
 {
     Trace.WriteLine("WARNING! clSetCommandQueueProperty has been deprecated in OpenCL 1.1.");
     return CL10.SetCommandQueueProperty(command_queue, properties, enable, out old_properties);
 }
예제 #25
0
 public extern static CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     ComputeCommandQueueFlags properties,
     out ComputeErrorCode errcode_ret);
예제 #26
0
파일: CL10.cs 프로젝트: yeerkkiller1/Go-AI
 public static unsafe extern IntPtr CreateCommandQueue(
     IntPtr context,
     IntPtr device,
     ComputeCommandQueueFlags properties,
     ComputeErrorCode* errcode_ret);
예제 #27
0
파일: CL11.cs 프로젝트: yeerkkiller1/Go-AI
 public static unsafe new ComputeErrorCode SetCommandQueueProperty(
     IntPtr command_queue,
     ComputeCommandQueueFlags properties,
     ComputeBoolean enable,
     out ComputeCommandQueueFlags old_properties)
 {
     throw new NotSupportedException("This function has been deprecated in OpenCL 1.1");
 }
예제 #28
0
 public static void SetCommandQueuePropertyWrapper(CLCommandQueueHandle command_queue, ComputeCommandQueueFlags properties, bool enable, out ComputeCommandQueueFlags old_properties)
 {
     ComputeException.ThrowOnError(SetCommandQueueProperty(command_queue, properties, enable, out old_properties));
 }