/// <summary>
 /// Creates a new <see cref="ComputeContextPropertyList"/> which contains a single item specifying a <see cref="ComputePlatform"/>.
 /// </summary>
 /// <param name="platform"> A <see cref="ComputePlatform"/>. </param>
 public ComputeContextPropertyList(ComputePlatform platform)
 {
     _properties = new List <ComputeContextProperty>
     {
         new ComputeContextProperty(ComputeContextPropertyName.Platform, platform.Handle.Value)
     };
 }
示例#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 [] { ' ' }, 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, CL12.GetDeviceInfo)));
            _maxWriteImageArgs     = GetInfo <uint>(ComputeDeviceInfo.MaxWriteImageArguments);
            _memBaseAddrAlign      = GetInfo <uint>(ComputeDeviceInfo.MemoryBaseAddressAlignment);
            _minDataTypeAlignSize  = GetInfo <uint>(ComputeDeviceInfo.MinDataTypeAlignmentSize);
            _name     = GetStringInfo(ComputeDeviceInfo.Name);
            _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);
        }