Changeset 16c1297 in sasview
- Timestamp:
- Nov 29, 2016 6:59:59 AM (8 years ago)
- Children:
- 9fdf302
- Parents:
- c2cb772
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
rf78c7d2 r16c1297 194 194 195 195 self.id_gpu_options_panel = wx.NewId() 196 self.menu1.Append(self.id_gpu_options_panel, " GPU Options", "Choose how to compile models")196 self.menu1.Append(self.id_gpu_options_panel, "OpenCL Options", "Choose OpenCL driver or turn it off") 197 197 wx.EVT_MENU(owner, self.id_gpu_options_panel, self.on_gpu_options) 198 198 -
src/sas/sasgui/perspectives/fitting/gpu_options.py
rc2cb772 r16c1297 1 1 ''' 2 Created on Feb 18, 20152 Created on Nov 29, 2016 3 3 4 @author: jkrzywon4 @author: wpotrzebowski 5 5 ''' 6 7 __id__ = "$Id: acknoweldgebox.py 2015-18-02 jkrzywon $"8 __revision__ = "$Revision: 1193 $"9 6 10 7 import wx 11 8 import wx.richtext 12 9 import wx.lib.hyperlink 13 import random14 import os.path15 10 import os 11 12 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 13 16 14 try: 17 15 # Try to find a local config … … 44 42 wx.Dialog.__init__(self, *args, **kwds) 45 43 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 54 44 clinfo = self._get_clinfo() 55 45 self.panel1 = wx.Panel(self, -1) 56 static_box1 = wx.StaticBox(self.panel1, -1, " OpenCL Options")46 static_box1 = wx.StaticBox(self.panel1, -1, "Available OpenCL Options:") 57 47 58 48 rows = len(clinfo) … … 116 106 117 107 self.Centre() 118 #self.__set_properties()119 #self.__do_layout()120 108 121 def __set_properties(self): 122 """ 123 :TODO - add method documentation 124 """ 125 self.SetTitle("Fitting on GPU Options") 126 self.SetSize((400, 150)) 127 # end wxGlade 128 129 def __do_layout(self): 130 """ 131 :TODO - add method documentation 132 """ 133 sizer_main = wx.BoxSizer(wx.VERTICAL) 134 135 self.SetAutoLayout(True) 136 self.SetSizer(sizer_main) 137 self.Layout() 138 self.Centre() 139 # end wxGlade 109 def _get_clinfo(self): 110 try: 111 import pyopencl as cl 112 devices = cl.get_platforms()[0].get_devices() 113 clinfo = [dev.name for dev in devices] 114 clinfo.append("No OpenCL") 115 except: 116 warnings.warn(str(exc)) 117 warnings.warn("pyopencl import failed") 118 clinfo = None 119 return clinfo 140 120 141 121 def OnRadio(self, event): 142 122 import sasmodels 143 123 button = event.GetEventObject() 144 print(self.option_button[button.Name])145 124 os.environ["SAS_OPENCL"] = self.option_button[button.Name] 146 125 sasmodels.kernelcl.ENV = None 147 126 reload(sasmodels.core) 148 #if self.option_button[button.Name] == "None":149 # sasmodels.core.HAVE_OPENCL = False150 #else:151 # sasmodels.kernelcl.ENV.152 127 153 128 def OnAccept(self, event): … … 161 136 Provide help on the selected fitter. 162 137 """ 163 #if self.help is not None: 164 # self.help(self._get_fitter()) 138 _TreeLocation = "user/gpu_computations.html" 139 _anchor = "#device-selection" 140 DocumentationWindow(self, -1, 141 _TreeLocation, _anchor, "OpenCL Options Help") 165 142 166 143 def OnClose(self, event):
Note: See TracChangeset
for help on using the changeset viewer.