コード例 #1
0
        public ReadOnlyCollection <ComputeDevice> QueryDevices()
        {
            int handlesLength = 0;

            CL10.GetDeviceIDs(handle, ComputeDeviceTypes.All, 0, null, out handlesLength);

            IntPtr[] handles = new IntPtr[handlesLength];
            CL10.GetDeviceIDs(handle, ComputeDeviceTypes.All, handlesLength, handles, out handlesLength);

            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);
        }