Changeset 9a26428 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Nov 24, 2016 6:07:06 AM (8 years ago)
Author:
wojciech
Children:
c2cb772
Parents:
f78c7d2
Message:

Support to read available OpenCL infrastructure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/gpu_options.py

    rf78c7d2 r9a26428  
    4444        wx.Dialog.__init__(self, *args, **kwds) 
    4545 
    46         #TODO: 
    47         #Read in values for opencl context 
    48         #Tycially will be something like 
    49         #0 = GPU 
    50         #1 = CPU 
    51         #None for None 
     46        try: 
     47            from sasmodels.kernelcl import environment 
     48            env = environment() 
     49            clinfo = [ctx.devices[0].name 
     50                    for ctx in env.context] 
     51            clinfo.append("No OpenCL") 
     52        except ImportError: 
     53            clinfo = None 
    5254 
    5355        ##################################### 
     
    5557        static_box1 = wx.StaticBox(self.panel1, -1, "OpenCL Options") 
    5658 
    57         contextes = ("GPU","CPU","None") 
    58         rows = len(contextes) 
     59        #contextes = ("Intel(R) Iris(TM) Graphics 6100", 
     60        #             "Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz", 
     61        #             "No OpenCL") 
     62        rows = len(clinfo) 
    5963 
    6064        flexsizer = wx.FlexGridSizer(rows, 1, hgap=20, vgap=10) 
    6165        self.fitter_button = {} 
    62         for fitter in contextes: 
     66        for fitter in clinfo: 
    6367            button = wx.RadioButton(self.panel1, -1, 
    6468                    label=fitter, name=fitter) 
     
    97101        self.SetTitle("Fitting on GPU Options") 
    98102        #Increased size of box from (525, 225), SMK, 04/10/16 
    99         self.SetSize((600, 300)) 
     103        self.SetSize((400, 150)) 
    100104        # end wxGlade 
    101105 
Note: See TracChangeset for help on using the changeset viewer.