Changeset e2c0939 in sasview
- Timestamp:
- Jan 5, 2017 9:43:08 AM (8 years ago)
- Children:
- 92583049
- Parents:
- c85679b
- Location:
- src/sas/sasgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
r2a1b92eb re2c0939 2110 2110 """ 2111 2111 #IF SAS_OPENCL is set, settings are stored in the custom config file 2112 if "SAS_OPENCL" in os.environ: 2113 self._write_opencl_config_file() 2112 self._write_opencl_config_file() 2114 2113 logging.info(" --- SasView session was closed --- \n") 2115 2114 wx.Exit() … … 2120 2119 #from sas.sasgui.guiframe.gui_manager import _find_local_config 2121 2120 2122 sas_opencl = os.environ.get("SAS_OPENCL", "")2121 sas_opencl = os.environ.get("SAS_OPENCL",None) 2123 2122 #How to store it in file 2124 2123 new_config_lines = [] -
src/sas/sasgui/perspectives/fitting/gpu_options.py
r2a1b92eb re2c0939 11 11 import warnings 12 12 import wx 13 import logging14 13 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 15 import imp 14 16 15 17 16 … … 80 79 #Check if SAS_OPENCL is already set as enviromental variable 81 80 self.sas_opencl = os.environ.get("SAS_OPENCL","") 82 print("SAS_OPENCL: ",self.sas_opencl) 83 81 84 82 for clopt in clinfo: 85 83 button = wx.CheckBox(self.panel1, -1, label=clopt[1], name=clopt[1]) … … 177 175 return clinfo 178 176 179 #TODO: Dont want to mess with writting to configuration file before end of180 def _write_to_config_file(self):181 from sas.sasgui.guiframe.customdir import SetupCustom182 from sas.sasgui.guiframe.gui_manager import _find_local_config183 184 c_conf_dir = SetupCustom().find_dir()185 self.custom_config = _find_local_config('custom_config', c_conf_dir)186 if self.custom_config is None:187 self.custom_config = _find_local_config('custom_config', os.getcwd())188 189 #How to store it in file190 new_config_lines = []191 config_file = open(self.custom_config.__file__[:-1])192 if self.custom_config is not None:193 config_lines = config_file.readlines()194 for line in config_lines:195 if "SAS_OPENCL" in line:196 if self.sas_opencl:197 new_config_lines.append("SAS_OPENCL = \""+self.sas_opencl+"\"")198 else:199 new_config_lines.append("SAS_OPENCL = None")200 else:201 new_config_lines.append(line)202 config_file.close()203 new_config_file = open(self.custom_config.__file__[:-1],"w")204 new_config_file.writelines(new_config_lines)205 new_config_file.close()206 207 #After file is touched module needs to be reloaded208 self.custom_config = _find_local_config('custom_config', c_conf_dir)209 if self.custom_config is None:210 self.custom_config = _find_local_config('custom_config', os.getcwd())211 212 177 def on_check(self, event): 213 178 """ … … 236 201 if "SAS_OPENCL" in os.environ: 237 202 del(os.environ["SAS_OPENCL"]) 238 sasmodels.kernelcl.ENV = None 203 204 #Sasmodels kernelcl doesn't exist when initiated with None 205 try: 206 sasmodels.kernelcl.ENV = None 207 except: 208 pass 209 239 210 #Need to reload sasmodels.core module to account SAS_OPENCL = "None" 240 211 reload(sasmodels.core)
Note: See TracChangeset
for help on using the changeset viewer.