Changes in / [d742b56:630aa5b] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/gpu_options.py
r8e109f9 r388aefb 8 8 ''' 9 9 10 import json11 import platform12 10 import logging 13 11 import os 14 12 import sys 15 16 13 import wx 17 18 try:19 import pyopencl as cl20 except ImportError:21 cl = None22 23 14 import sasmodels 24 import sasmodels.model_test25 import sasmodels.kernelcl26 27 15 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 28 16 … … 181 169 clinfo = [] 182 170 platforms = [] 183 184 if cl is None: 171 try: 172 import pyopencl as cl 173 platforms = cl.get_platforms() 174 except ImportError: 185 175 logger.warn("Unable to import the pyopencl package. It may not " 186 176 "have been installed. If you wish to use OpenCL, try " 187 177 "running pip install --user pyopencl") 188 else: 189 try: 190 platforms = cl.get_platforms() 191 except cl.LogicError as err: 192 logger.warn("Unable to fetch the OpenCL platforms. This likely " 193 "means that the opencl drivers for your system are " 194 "not installed.") 195 logger.warn(err) 178 except cl.LogicError as err: 179 logger.warn("Unable to fetch the OpenCL platforms. This likely " 180 "means that the opencl drivers for your system are " 181 "not installed.") 182 logger.warn(err) 196 183 197 184 p_index = 0 … … 239 226 if "SAS_OPENCL" in os.environ: 240 227 del os.environ["SAS_OPENCL"] 241 sasmodels.kernelcl.reset_environment() 228 229 #Sasmodels kernelcl doesn't exist when initiated with None 230 if 'sasmodels.kernelcl' in sys.modules: 231 sasmodels.kernelcl.ENV = None 232 233 reload(sasmodels.core) 242 234 event.Skip() 243 235 … … 255 247 Run sasmodels check from here and report results from 256 248 """ 249 import json 250 import platform 251 #import sasmodels 252 257 253 #The same block of code as for OK but it is needed if we want to have 258 254 #active response to Test button … … 265 261 if "SAS_OPENCL" in os.environ: 266 262 del os.environ["SAS_OPENCL"] 267 sasmodels.kernelcl.reset_environment() 263 264 #Sasmodels kernelcl doesn't exist when initiated with None 265 if 'sasmodels.kernelcl' in sys.modules: 266 sasmodels.kernelcl.ENV = None 267 268 269 #Need to reload sasmodels.core module to account SAS_OPENCL = "None" 270 reload(sasmodels.core) 271 272 273 from sasmodels.model_test import model_tests 268 274 269 275 try: 270 env = sasmodels.kernelcl.environment() 276 from sasmodels.kernelcl import environment 277 env = environment() 271 278 clinfo = [(ctx.devices[0].platform.vendor, 272 279 ctx.devices[0].platform.version, … … 275 282 ctx.devices[0].version) 276 283 for ctx in env.context] 277 except Exception:284 except ImportError: 278 285 clinfo = None 279 286 280 287 failures = [] 281 288 tests_completed = 0 282 for test in sasmodels.model_test.model_tests():289 for test in model_tests(): 283 290 try: 284 291 test()
Note: See TracChangeset
for help on using the changeset viewer.