Example #1
0
        internal ClPlatform copy()
        {
            IntPtr     hList = Cores.platformList();
            ClPlatform tmp   = new ClPlatform(hList, platformIndex);

            Cores.deletePlatformList(hList);
            return(tmp);
        }
Example #2
0
        public ClDevice(ClPlatform clPlatform, int deviceTypeCodeInClPlatform, int i, bool devicePartition, bool GPU_STREAM, int MAX_CPU)
        {
            clPlatformForCopy = clPlatform;
            deviceTypeCodeInClPlatformForCopy = deviceTypeCodeInClPlatform;
            iForCopy = i;
            devicePartitionForCopy   = devicePartition;
            GPU_STREAMForCopy        = GPU_STREAM;
            MAX_CPUForCopy           = MAX_CPU;
            deviceNameClString       = new ClString(" ");
            deviceVendorNameClString = new ClString(" ");
            hPlatform = clPlatform.h();
            if (deviceTypeCodeInClPlatform == ClPlatform.CODE_CPU() && devicePartition)
            {
                int epc1 = Environment.ProcessorCount - 1;
                if (MAX_CPU != -1)
                {
                    epc1 = Math.Max(Math.Min(MAX_CPU, epc1), 1);
                }
                Console.WriteLine(epc1 + " cores are chosen for compute(equals to device partition cores).");

                hDevice = createDeviceAsPartition(hPlatform, deviceTypeCodeInClPlatform, i, epc1);
            }
            else
            {
                hDevice = createDevice(hPlatform, deviceTypeCodeInClPlatform, i);
            }
            getDeviceName(hDevice, deviceNameClString.h());
            getDeviceVendorName(hDevice, deviceVendorNameClString.h());
            numberOfComputeUnitsPrivate            = deviceComputeUnits(hDevice);
            memorySizePrivate                      = deviceMemSize(hDevice);
            deviceNameStringFromOpenclCSpace       = JsonCPPCS.readWithDispose(deviceNameClString.h());
            deviceVendorNameStringFromOpenclCSpace = JsonCPPCS.readWithDispose(deviceVendorNameClString.h());
            typeOfUsedDeviceInClPlatform           = deviceTypeCodeInClPlatform;
            if (GPU_STREAM)
            {
                GDDR = false;
            }
            else
            {
                GDDR = deviceGDDR(hDevice);
            }
        }