Esempio n. 1
0
 public extern static ComputeErrorCode GetKernelWorkGroupInfo(
     CLKernelHandle kernel,
     CLDeviceHandle device,
     ComputeKernelWorkGroupInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="clDeviceHandle"></param>
 public GpuDevice(CLDeviceHandle clDeviceHandle)
 {
     CLDeviceHandle = clDeviceHandle;
     CLDevice = ComputePlatform.Platforms
         .SelectMany(i => i.Devices)
         .SingleOrDefault(i => i.Handle.Value == CLDeviceHandle.Value);
 }
Esempio n. 3
0
 public extern static ComputeErrorCode GetProgramBuildInfo(
     CLProgramHandle program,
     CLDeviceHandle device,
     ComputeProgramBuildInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 4
0
 public ComputeErrorCode GetProgramBuildInfo(CLProgramHandle program, CLDeviceHandle device, ComputeProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return StaticGetProgramBuildInfo(program, device, param_name, param_value_size, param_value,out param_value_size_ret);
 }
Esempio n. 5
0
 public ComputeErrorCode GetDeviceInfo(CLDeviceHandle device, ComputeDeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return StaticGetDeviceInfo(device, param_name, param_value_size, param_value, out param_value_size_ret);
 }
Esempio n. 6
0
 public CLCommandQueueHandle CreateCommandQueueWithProperties(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public static void GetKernelWorkGroupInfoWrapper(CLKernelHandle kernel, CLDeviceHandle device, ComputeKernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     ComputeException.ThrowOnError(GetKernelWorkGroupInfo(kernel, device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 8
0
 public static extern ComputeErrorCode StaticCreateSubDevices(CLDeviceHandle device, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] properties, System.Int32 num_devices, [Out, MarshalAs(UnmanagedType.LPArray)] CLDeviceHandle[] devices, out IntPtr num_devices_ret);
Esempio n. 9
0
 public static void GetDeviceInfoWrapper(CLDeviceHandle device, ComputeDeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     ComputeException.ThrowOnError(GetDeviceInfo(device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 10
0
 public new CLCommandQueueHandle CreateCommandQueueWithProperties(CLContextHandle context, CLDeviceHandle device, ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return StaticCreateCommandQueueWithProperties(context, device, properties, out errcode_ret);
 }
Esempio n. 11
0
 ComputeErrorCode ICL10.GetKernelWorkGroupInfo(CLKernelHandle kernel, CLDeviceHandle device,
                                               ComputeKernelWorkGroupInfo param_name, IntPtr param_value_size,
                                               IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return(GetKernelWorkGroupInfo(kernel, device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 12
0
 ComputeErrorCode ICL10.GetProgramBuildInfo(CLProgramHandle program, CLDeviceHandle device, ComputeProgramBuildInfo param_name,
                                            IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return(GetProgramBuildInfo(program, device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 13
0
 CLCommandQueueHandle ICL10.CreateCommandQueue(CLContextHandle context, CLDeviceHandle device,
                                               ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return(CreateCommandQueue(context, device, properties, out errcode_ret));
 }
Esempio n. 14
0
 ComputeErrorCode ICL10.GetDeviceInfo(CLDeviceHandle device, ComputeDeviceInfo param_name, IntPtr param_value_size,
                                      IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return(GetDeviceInfo(device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 15
0
 public static void SetDefaultDeviceCommandQueueWrapper(CLContextHandle context, CLDeviceHandle device, CLCommandQueueHandle command_queue)
 {
     ComputeException.ThrowOnError(SetDefaultDeviceCommandQueue(context, device, command_queue));
 }
Esempio n. 16
0
 public static extern CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     ComputeCommandQueueFlags properties,
     out ComputeErrorCode errcode_ret);
Esempio n. 17
0
 public static extern ComputeErrorCode GetKernelWorkGroupInfo(
     CLKernelHandle kernel,
     CLDeviceHandle device,
     ComputeKernelWorkGroupInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 18
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);
 }
Esempio n. 19
0
 public extern static ComputeErrorCode GetDeviceInfo(
     CLDeviceHandle device,
     ComputeDeviceInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 20
0
        internal static CLDeviceHandle[] ExtractDeviceHandles(ICollection<ComputeDevice> computeObjects, out int handleCount)
        {
            if (computeObjects == null || computeObjects.Count == 0)
            {
                handleCount = 0;
                return null;
            }

            CLDeviceHandle[] result = new CLDeviceHandle[computeObjects.Count];
            int i = 0;
            foreach (ComputeDevice computeObj in computeObjects)
            {
                result[i] = computeObj.Handle;
                i++;
            }
            handleCount = computeObjects.Count;
            return result;
        }
Esempio n. 21
0
 public new ComputeErrorCode RetainDevice(CLDeviceHandle device)
 {
     return StaticRetainDevice(device);
 }
Esempio n. 22
0
 CLProgramHandle ICL10.CreateProgramWithBinary(CLContextHandle context, int num_devices, CLDeviceHandle[] device_list,
                                               IntPtr[] lengths, IntPtr[] binaries, int[] binary_status,
                                               out ComputeErrorCode errcode_ret)
 {
     return CreateProgramWithBinary(context, num_devices, device_list, lengths, binaries, binary_status, out errcode_ret);
 }
Esempio n. 23
0
 public static void GetProgramBuildInfoWrapper(CLProgramHandle program, CLDeviceHandle device, ComputeProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     ComputeException.ThrowOnError(GetProgramBuildInfo(program, device, param_name, param_value_size, param_value, out param_value_size_ret));
 }
Esempio n. 24
0
 ComputeErrorCode ICL10.BuildProgram(CLProgramHandle program, int num_devices, CLDeviceHandle[] device_list, string options,
                                     ComputeProgramBuildNotifier pfn_notify, IntPtr user_data)
 {
     return BuildProgram(program, num_devices, device_list, options, pfn_notify, user_data);
 }
Esempio n. 25
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);
        }
Esempio n. 26
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);
 }
Esempio n. 27
0
 public ComputeErrorCode CreateSubDevices(CLDeviceHandle device, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] properties, int num_devices, [MarshalAs(UnmanagedType.LPArray), Out] CLDeviceHandle[] devices, out int num_devices_ret)
 {
     throw new NotImplementedException();
 }
Esempio n. 28
0
 ComputeErrorCode ICL10.GetDeviceInfo(CLDeviceHandle device, ComputeDeviceInfo param_name, IntPtr param_value_size,
                                      IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return GetDeviceInfo(device, param_name, param_value_size, param_value, out param_value_size_ret);
 }
Esempio n. 29
0
 public ComputeErrorCode GetKernelWorkGroupInfo(CLKernelHandle kernel, CLDeviceHandle device, ComputeKernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, out IntPtr param_value_size_ret)
 {
     return StaticGetKernelWorkGroupInfo(kernel, device, param_name, param_value_size, param_value, out param_value_size_ret);
 }
Esempio n. 30
0
 CLCommandQueueHandle ICL10.CreateCommandQueue(CLContextHandle context, CLDeviceHandle device,
                                               ComputeCommandQueueFlags properties, out ComputeErrorCode errcode_ret)
 {
     return CreateCommandQueue(context, device, properties, out errcode_ret);
 }
Esempio n. 31
0
 public ComputeErrorCode RetainDevice(CLDeviceHandle device)
 {
     throw new NotImplementedException();
 }
Esempio n. 32
0
 CLContextHandle ICL10.CreateContext(IntPtr[] properties, int num_devices, CLDeviceHandle[] devices,
                                     ComputeContextNotifier pfn_notify, IntPtr user_data, out ComputeErrorCode errcode_ret)
 {
     return CreateContext(properties, num_devices, devices, pfn_notify, user_data, out errcode_ret);
 }
Esempio n. 33
0
 public static extern ComputeErrorCode GetDeviceInfo(
     CLDeviceHandle device,
     ComputeDeviceInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 34
0
 public extern static CLCommandQueueHandle CreateCommandQueueWithProperties(
     CLContextHandle context,
     CLDeviceHandle device,
     [MarshalAs(UnmanagedType.LPArray)] ComputeCommandQueueFlags[] properties,
     out ComputeErrorCode errcode_ret);
Esempio n. 35
0
 public static extern ComputeErrorCode GetProgramBuildInfo(
     CLProgramHandle program,
     CLDeviceHandle device,
     ComputeProgramBuildInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Esempio n. 36
0
        /// <summary>
        /// Gets a read-only collection of available <see cref="ComputeDevice"/>s on the <see cref="ComputePlatform"/>.
        /// </summary>
        /// <returns> A read-only collection of the available <see cref="ComputeDevice"/>s on the <see cref="ComputePlatform"/>. </returns>
        /// <remarks> This method resets the <c>ComputePlatform.Devices</c>. This is useful if one or more of them become unavailable (<c>ComputeDevice.Available</c> is <c>false</c>) after a <see cref="ComputeContext"/> and <see cref="ComputeCommandQueue"/>s that use the <see cref="ComputeDevice"/> have been created and commands have been queued to them. Further calls will trigger an <c>OutOfResourcesComputeException</c> until this method is executed. You will also need to recreate any <see cref="ComputeResource"/> that was created on the no longer available <see cref="ComputeDevice"/>. </remarks>
        public ReadOnlyCollection<ComputeDevice> QueryDevices()
        {
            int handlesLength = 0;
            ComputeErrorCode error = CLInterface.CL12.GetDeviceIDs(Handle, ComputeDeviceTypes.All, 0, null, out handlesLength);
            ComputeException.ThrowOnError(error);

            CLDeviceHandle[] handles = new CLDeviceHandle[handlesLength];
            error = CLInterface.CL12.GetDeviceIDs(Handle, ComputeDeviceTypes.All, handlesLength, handles, out handlesLength);
            ComputeException.ThrowOnError(error);

            ComputeDevice[] devices = new ComputeDevice[handlesLength];
            for (int i = 0; i < handlesLength; i++)
                devices[i] = new ComputeDevice(this, handles[i]);

            this.devices = new ReadOnlyCollection<ComputeDevice>(devices);

            return this.devices;
        }
Esempio n. 37
0
 public extern static ComputeErrorCode CreateSubDevices(
     CLDeviceHandle in_device,
     UInt32 num_devices,
     cl_device_partition_property[] properties,
     [Out, MarshalAs(UnmanagedType.LPArray)] CLDeviceHandle[] out_devices,
     out UInt32 num_devices_ret);
Esempio n. 38
0
 public static extern ComputeErrorCode StaticRetainDevice(CLDeviceHandle device);
Esempio n. 39
0
 public extern static CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     ComputeCommandQueueFlags properties,
     out ComputeErrorCode errcode_ret);
Esempio n. 40
0
 public extern static ComputeErrorCode SetDefaultDeviceCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     CLCommandQueueHandle command_queue);