示例#1
0
        public cpuminer(int id, int threads, ulong affinity)
            : base(DeviceType.CPU, "CPU" + id.ToString())
        {
            Threads      = threads;
            AffinityMask = affinity;

            bool isInitialized = InitializeMinerPaths();

            // if our CPU is supported add it to devices
            // TODO if Miner and ComputeDevice decoupling redo this this is going to be at detecting CPUs
            if (isInitialized)
            {
                CDevs.Add(new ComputeDevice(0, MinerDeviceName, CPUID.GetCPUName().Trim(), Threads, true));
            }
        }
示例#2
0
        private void QueryCPUs()
        {
            Helpers.ConsolePrint(TAG, "QueryCPUs START");
            // get all CPUs
            CPUs = CPUID.GetPhysicalProcessorCount();

            // get all cores (including virtual - HT can benefit mining)
            int ThreadsPerCPU = CPUID.GetVirtualCoresCount() / CPUs;

            if (!Helpers.InternalCheckIsWow64())
            {
                MessageBox.Show(International.GetText("Form_Main_msgbox_CPUMining64bitMsg"),
                                International.GetText("Warning_with_Exclamation"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                CPUs = 0;
            }

            if (ThreadsPerCPU * CPUs > 64)
            {
                MessageBox.Show(International.GetText("Form_Main_msgbox_CPUMining64CoresMsg"),
                                International.GetText("Warning_with_Exclamation"),
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                CPUs = 0;
            }

            // TODO important move this to settings
            int ThreadsPerCPUMask = ThreadsPerCPU;

            Globals.ThreadsPerCPU = ThreadsPerCPU;

            if (cpuminer.InitializeMinerPaths())
            {
                if (CPUs == 1)
                {
                    new ComputeDevice(0, "CPU0", CPUID.GetCPUName().Trim(), ThreadsPerCPU, (ulong)0, true);
                    //MinersManager.Instance.AddCpuMiner(new cpuminer(0, ThreadsPerCPU, 0), 0, CPUID.GetCPUName().Trim());
                }
                else
                {
                    for (int i = 0; i < CPUs; i++)
                    {
                        new ComputeDevice(0, "CPU" + i, CPUID.GetCPUName().Trim(), ThreadsPerCPU, CPUID.CreateAffinityMask(i, ThreadsPerCPUMask), true);
                    }
                }
            }

            Helpers.ConsolePrint(TAG, "QueryCPUs END");
        }