/// <summary>
 /// Gets the compile work-group size specified by the <c>__attribute__((reqd_work_group_size(X, Y, Z)))</c> qualifier.
 /// </summary>
 /// <param name="device"> One of the device. </param>
 /// <returns> The compile work-group size specified by the <c>__attribute__((reqd_work_group_size(X, Y, Z)))</c> qualifier. If no such qualifier is specified, (0, 0, 0) is returned. </returns>
 public long[] GetCompileWorkGroupSize(IComputeDevice device)
 {
     return(ComputeTools.ConvertArray(
                GetArrayInfo <CLKernelHandle, CLDeviceHandle, ComputeKernelWorkGroupInfo, IntPtr>(
                    Handle, device.Handle, ComputeKernelWorkGroupInfo.CompileWorkGroupSize, OpenCL200.GetKernelWorkGroupInfo)));
 }
Exemplo n.º 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);
            MaxMemoryAllocationSize    = (long)GetInfo <ulong>(ComputeDeviceInfo.MaxMemoryAllocationSize);
            MaxParameterSize           = (long)GetInfo <IntPtr>(ComputeDeviceInfo.MaxParameterSize);
            MaxReadImageArguments      = 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)));
            MaxWriteImageArguments     = GetInfo <uint>(ComputeDeviceInfo.MaxWriteImageArguments);
            MemoryBaseAddressAlignment = GetInfo <uint>(ComputeDeviceInfo.MemoryBaseAddressAlignment);
            MinDataTypeAlignmentSize   = GetInfo <uint>(ComputeDeviceInfo.MinDataTypeAlignmentSize);
            Name     = GetStringInfo(ComputeDeviceInfo.Name);
            Platform = platform;
            PreferredVectorWidthChar   = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthChar);
            PreferredVectorWidthDouble = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthDouble);
            PreferredVectorWidthFloat  = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthFloat);
            PreferredVectorWidthHalf   = GetInfo <uint>(ComputeDeviceInfo.PreferredVectorWidthHalf);
            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);
            CommandQueueFlags        = (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);
            VersionString = GetStringInfo(ComputeDeviceInfo.Version);
            Version       = ComputeTools.ParseVersionString(VersionString, 1);
        }