Exemplo n.º 1
0
        static ComputePlatform()
        {
            lock (typeof(ComputePlatform))
            {
                try
                {
                    if (platforms != null)
                        return;

                    CLPlatformHandle[] handles;
                    int handlesLength;
                    ComputeErrorCode error = CL12.GetPlatformIDs(0, null, out handlesLength);
                    ComputeException.ThrowOnError(error);
                    handles = new CLPlatformHandle[handlesLength];

                    error = CL12.GetPlatformIDs(handlesLength, handles, out handlesLength);
                    ComputeException.ThrowOnError(error);

                    List<ComputePlatform> platformList = new List<ComputePlatform>(handlesLength);
                    foreach (CLPlatformHandle handle in handles)
                        platformList.Add(new ComputePlatform(handle));

                    platforms = platformList.AsReadOnly();
                }
                catch (DllNotFoundException)
                {
                    platforms = new List<ComputePlatform>().AsReadOnly();
                }
            }
        }
Exemplo n.º 2
0
 public static extern ComputeErrorCode GetPlatformInfo(
     CLPlatformHandle platform,
     ComputePlatformInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Exemplo n.º 3
0
 public static extern ComputeErrorCode GetDeviceIDs(
     CLPlatformHandle platform,
     ComputeDeviceTypes device_type,
     Int32 num_entries,
     [Out, MarshalAs(UnmanagedType.LPArray)] CLDeviceHandle[] devices,
     out Int32 num_devices);
Exemplo n.º 4
0
 public ComputeErrorCode GetPlatformInfo(CLPlatformHandle platform, ComputePlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return StaticGetPlatformInfo(platform, param_name, param_value_size, param_value, out param_value_size_ret);
 }
Exemplo n.º 5
0
 public IntPtr GetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, string func_name)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public new IntPtr GetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, String func_name)
 {
     return StaticGetExtensionFunctionAddressForPlatform(platform, func_name);
 }
Exemplo n.º 7
0
 public static extern IntPtr StaticGetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, String func_name);
Exemplo n.º 8
0
 public static void GetDeviceIDsWrapper(CLPlatformHandle platform, ComputeDeviceTypes device_type, Int32 num_entries, CLDeviceHandle[] devices, out Int32 num_devices)
 {
     ComputeException.ThrowOnError(GetDeviceIDs(platform, device_type, num_entries, devices, out num_devices));
 }
Exemplo n.º 9
0
 ComputeErrorCode ICL10.GetPlatformInfo(CLPlatformHandle platform, ComputePlatformInfo param_name, IntPtr param_value_size,
                                        IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return GetPlatformInfo(platform, param_name, param_value_size, param_value, out param_value_size_ret);
 }
Exemplo n.º 10
0
 ComputeErrorCode ICL10.GetDeviceIDs(CLPlatformHandle platform, ComputeDeviceTypes device_type, int num_entries,
                                     CLDeviceHandle[] devices, out int num_devices)
 {
     return GetDeviceIDs(platform, device_type, num_entries, devices, out num_devices);
 }
Exemplo n.º 11
0
 ComputeErrorCode ICL10.GetPlatformIDs(int num_entries, CLPlatformHandle[] platforms, out int num_platforms)
 {
     return GetPlatformIDs(num_entries, platforms, out num_platforms);
 }
Exemplo n.º 12
0
 ComputeErrorCode ICL10.GetDeviceIDs(CLPlatformHandle platform, ComputeDeviceTypes device_type, int num_entries,
                                     CLDeviceHandle[] devices, out int num_devices)
 {
     return(GetDeviceIDs(platform, device_type, num_entries, devices, out num_devices));
 }
Exemplo n.º 13
0
 ComputeErrorCode ICL10.GetPlatformInfo(CLPlatformHandle platform, ComputePlatformInfo param_name, IntPtr param_value_size,
                                        IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return(GetPlatformInfo(platform, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Exemplo n.º 14
0
 public static extern IntPtr GetExtensionFunctionAddressForPlatform(
     CLPlatformHandle platform,
     String func_name);
Exemplo n.º 15
0
 public extern static ComputeErrorCode GetPlatformInfo(
     CLPlatformHandle platform,
     ComputePlatformInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Exemplo n.º 16
0
        private ComputePlatform(CLPlatformHandle handle)
        {
            Handle = handle;
            SetID(Handle.Value);

            string extensionString = GetStringInfo<CLPlatformHandle, ComputePlatformInfo>(Handle, ComputePlatformInfo.Extensions, CLInterface.CL12.GetPlatformInfo);
            extensions = new ReadOnlyCollection<string>(extensionString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

            name = GetStringInfo<CLPlatformHandle, ComputePlatformInfo>(Handle, ComputePlatformInfo.Name, CLInterface.CL12.GetPlatformInfo);
            profile = GetStringInfo<CLPlatformHandle, ComputePlatformInfo>(Handle, ComputePlatformInfo.Profile, CLInterface.CL12.GetPlatformInfo);
            vendor = GetStringInfo<CLPlatformHandle, ComputePlatformInfo>(Handle, ComputePlatformInfo.Vendor, CLInterface.CL12.GetPlatformInfo);
            version = GetStringInfo<CLPlatformHandle, ComputePlatformInfo>(Handle, ComputePlatformInfo.Version, CLInterface.CL12.GetPlatformInfo);
            QueryDevices();
        }
Exemplo n.º 17
0
 public extern static ComputeErrorCode GetDeviceIDs(
     CLPlatformHandle platform,
     ComputeDeviceTypes device_type,
     Int32 num_entries,
     [Out, MarshalAs(UnmanagedType.LPArray)] CLDeviceHandle[] devices,
     out Int32 num_devices);
Exemplo n.º 18
0
 public static void GetPlatformInfoWrapper(CLPlatformHandle platform, ComputePlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     ComputeException.ThrowOnError(GetPlatformInfo(platform, param_name, param_value_size, param_value, out param_value_size_ret));
 }