예제 #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();
                }
            }
        }
예제 #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);
예제 #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);
예제 #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);
 }
예제 #5
0
 public IntPtr GetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, string func_name)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public new IntPtr GetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, String func_name)
 {
     return StaticGetExtensionFunctionAddressForPlatform(platform, func_name);
 }
예제 #7
0
 public static extern IntPtr StaticGetExtensionFunctionAddressForPlatform(CLPlatformHandle platform, String func_name);
예제 #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));
 }
예제 #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);
 }
예제 #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);
 }
예제 #11
0
 ComputeErrorCode ICL10.GetPlatformIDs(int num_entries, CLPlatformHandle[] platforms, out int num_platforms)
 {
     return GetPlatformIDs(num_entries, platforms, out num_platforms);
 }
예제 #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));
 }
예제 #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));
 }
예제 #14
0
 public static extern IntPtr GetExtensionFunctionAddressForPlatform(
     CLPlatformHandle platform,
     String func_name);
예제 #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);
예제 #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();
        }
예제 #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);
예제 #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));
 }