Пример #1
0
 public extern static OpenCLErrorCode GetKernelWorkGroupInfo(
     CLKernelHandle kernel,
     CLDeviceHandle device,
     OpenCLKernelWorkGroupInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #2
0
 public extern static OpenCLErrorCode GetProgramBuildInfo(
     CLProgramHandle program,
     CLDeviceHandle device,
     OpenCLProgramBuildInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #3
0
        /// <summary>
        /// Gets a read-only collection of available <see cref="OpenCLDevice"/>s on the <see cref="OpenCLPlatform"/>.
        /// </summary>
        /// <returns> A read-only collection of the available <see cref="OpenCLDevice"/>s on the <see cref="OpenCLPlatform"/>. </returns>
        /// <remarks> This method resets the <c>OpenCLPlatform.Devices</c>. This is useful if one or more of them become unavailable (<c>OpenCLDevice.Available</c> is <c>false</c>) after a <see cref="OpenCLContext"/> and <see cref="OpenCLCommandQueue"/>s that use the <see cref="OpenCLDevice"/> have been created and commands have been queued to them. Further calls will trigger an <c>OutOfResourcesOpenCLException</c> until this method is executed. You will also need to recreate any <see cref="OpenCLResource"/> that was created on the no longer available <see cref="OpenCLDevice"/>. </remarks>
        public ReadOnlyCollection<OpenCLDevice> QueryDevices()
        {
            int handlesLength = 0;
            OpenCLErrorCode error = CL10.GetDeviceIDs(Handle, OpenCLDeviceType.All, 0, null, out handlesLength);
            OpenCLException.ThrowOnError(error);

            CLDeviceHandle[] handles = new CLDeviceHandle[handlesLength];
            error = CL10.GetDeviceIDs(Handle, OpenCLDeviceType.All, handlesLength, handles, out handlesLength);
            OpenCLException.ThrowOnError(error);

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

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

            return this.devices;
        }
Пример #4
0
        internal static CLDeviceHandle[] ExtractHandles(IList<OpenCLDevice> computeObjects, out int handleCount)
        {
            if (computeObjects == null || computeObjects.Count == 0)
            {
                handleCount = 0;
                return null;
            }

            CLDeviceHandle[] result = new CLDeviceHandle[computeObjects.Count];
            int i = 0;
            foreach (OpenCLDevice computeObj in computeObjects)
            {
                result[i] = computeObj.Handle;
                i++;
            }
            handleCount = computeObjects.Count;
            return result;
        }
Пример #5
0
 public extern static OpenCLErrorCode GetDeviceInfo(
     CLDeviceHandle device,
     OpenCLDeviceInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #6
0
 public extern static OpenCLErrorCode GetKernelWorkGroupInfo(
     CLKernelHandle kernel,
     CLDeviceHandle device,
     OpenCLKernelWorkGroupInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #7
0
 public extern static OpenCLErrorCode GetProgramBuildInfo(
     CLProgramHandle program,
     CLDeviceHandle device,
     OpenCLProgramBuildInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #8
0
 public extern static CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     OpenCLCommandQueueProperties properties,
     out OpenCLErrorCode errcode_ret);
Пример #9
0
 public extern static OpenCLErrorCode GetDeviceInfo(
     CLDeviceHandle device,
     OpenCLDeviceInfo param_name,
     IntPtr param_value_size,
     IntPtr param_value,
     out IntPtr param_value_size_ret);
Пример #10
0
 public extern static CLCommandQueueHandle CreateCommandQueue(
     CLContextHandle context,
     CLDeviceHandle device,
     OpenCLCommandQueueProperties properties,
     out OpenCLErrorCode errcode_ret);