Changeset 2161


Ignore:
Timestamp:
Dec 3, 2010, 11:21:05 PM (11 years ago)
Author:
Sven Rech
Message:

keysearcher opencl stuff

Location:
trunk/CrypPlugins/KeySearcher
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/KeySearcher.cs

    r2158 r2161  
    307307        {
    308308            IsKeySearcherRunning = true;
     309            localBruteForceStopwatch.Reset();
    309310
    310311            //either byte[] CStream input or CryptoolStream Object input
     
    391392            {
    392393                keySearcherOpenCLCode = new KeySearcherOpenCLCode(this, encryptedData, sender, CostMaster, 256 * 256 * 256 * 16);
    393                 keySearcherOpenCLSubbatchOptimizer = new KeySearcherOpenCLSubbatchOptimizer(oclManager.CQ[settings.OpenCLDevice].Device.MaxWorkItemSizes.Aggregate(1, (x, y) => (x * (int)y)) / 8);
     394                keySearcherOpenCLSubbatchOptimizer = new KeySearcherOpenCLSubbatchOptimizer(settings.OpenCLMode, oclManager.CQ[settings.OpenCLDevice].Device.MaxWorkItemSizes.Aggregate(1, (x, y) => (x * (int)y)) / 8);
    394395                ((QuickWatch)QuickWatchPresentation).Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    395396                {
     
    483484                    userKey = oclManager.Context.CreateBuffer(MemFlags.USE_HOST_PTR, key.Length, new IntPtr((void*)ukp));
    484485
    485                
    486 
    487486                int subbatches = keySearcherOpenCLSubbatchOptimizer.GetAmountOfSubbatches(keyTranslator);
    488487                int subbatchSize = keyTranslator.GetOpenCLBatchSize() / subbatches;
    489488                ((QuickWatch) QuickWatchPresentation).Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate
    490489                                                                    {
    491                                                                         //((QuickWatch)QuickWatchPresentation).OpenCLPresentation.batches.Content = subbatches;
    492490                                                                        ((QuickWatch)QuickWatchPresentation).OpenCLPresentation.workItems.Content = subbatchSize;
    493491                                                                    }, null);
    494                 GuiLogMessage(string.Format("Now using {0} subbatches", subbatches), NotificationLevel.Info);
     492                //GuiLogMessage(string.Format("Now using {0} subbatches", subbatches), NotificationLevel.Info);
    495493               
    496494                float[] costArray = new float[subbatchSize];
    497495                Mem costs = oclManager.Context.CreateBuffer(MemFlags.READ_WRITE, costArray.Length * 4);
    498                
    499496
    500497                IntPtr[] globalWorkSize = { (IntPtr)subbatchSize };
  • trunk/CrypPlugins/KeySearcher/KeySearcherSettings.cs

    r2086 r2161  
    299299
    300300        private int openCLDevice;
    301         [TaskPane("OpenCL Device", "Choose the OpenCL you want to use.", GroupOpenCL, 2, false, DisplayLevel.Experienced, ControlType.DynamicComboBox, new string[] { "DevicesAvailable" })]
     301        [TaskPane("OpenCL Device", "Choose the OpenCL device you want to use.", GroupOpenCL, 2, false, DisplayLevel.Experienced, ControlType.DynamicComboBox, new string[] { "DevicesAvailable" })]
    302302        public int OpenCLDevice
    303303        {
     
    309309                    this.openCLDevice = value;
    310310                    OnPropertyChanged("OpenCLDevice");
     311                    HasChanges = true;
     312                }
     313            }
     314        }
     315
     316        private int openCLMode = 1;
     317        [TaskPane("OpenCL Mode", "Choose the OpenCL mode you want to use.", GroupOpenCL, 3, false, DisplayLevel.Experienced, ControlType.RadioButton, new string[] { "Low Load", "Normal Load", "High Load (use with caution)" })]
     318        public int OpenCLMode
     319        {
     320            get { return this.openCLMode; }
     321            set
     322            {
     323                if (value != this.openCLMode)
     324                {
     325                    this.openCLMode = value;
     326                    OnPropertyChanged("OpenCLMode");
    311327                    HasChanges = true;
    312328                }
  • trunk/CrypPlugins/KeySearcher/OpenCL/KeySearcherOpenCLSubbatchOptimizer.cs

    r2143 r2161  
    2020        private const long TOLERANCE = 500;
    2121        private readonly int maxNumberOfThreads;
     22        private int openCLMode;
    2223
    23         public KeySearcherOpenCLSubbatchOptimizer(int maxNumberOfThreads)
     24        public KeySearcherOpenCLSubbatchOptimizer(int openCLMode, int maxNumberOfThreads)
    2425        {
    2526            this.maxNumberOfThreads = maxNumberOfThreads;
     27            this.openCLMode = openCLMode;
    2628        }
    2729
     
    3133            {
    3234                this.keyTranslator = keyTranslator;
    33                
     35
    3436                //Find factors of OpenCL batch size:
    3537                List<Msieve.Factor> factors = Msieve.TrivialFactorization(keyTranslator.GetOpenCLBatchSize());
     
    4850                optimisticDecrease = false;
    4951                lastStepIncrease = false;
     52
     53                if (openCLMode == 1)    //normal load
     54                    DecreaseAmountOfSubbatches();
    5055            }
    5156
     
    96101        public void EndMeasurement()
    97102        {
     103            if (openCLMode != 2)
     104                return;
     105
    98106            var thisduration = DateTime.Now - begin;
    99107
Note: See TracChangeset for help on using the changeset viewer.