- Timestamp:
- Oct 11, 2018 1:54:35 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249
- Children:
- 1342f6a
- Parents:
- 67ed543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/gpu_options.py
r388aefb r8e109f9 8 8 ''' 9 9 10 import json 11 import platform 10 12 import logging 11 13 import os 12 14 import sys 15 13 16 import wx 17 18 try: 19 import pyopencl as cl 20 except ImportError: 21 cl = None 22 14 23 import sasmodels 24 import sasmodels.model_test 25 import sasmodels.kernelcl 26 15 27 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 16 28 … … 169 181 clinfo = [] 170 182 platforms = [] 171 try: 172 import pyopencl as cl 173 platforms = cl.get_platforms() 174 except ImportError: 183 184 if cl is None: 175 185 logger.warn("Unable to import the pyopencl package. It may not " 176 186 "have been installed. If you wish to use OpenCL, try " 177 187 "running pip install --user pyopencl") 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) 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) 183 196 184 197 p_index = 0 … … 226 239 if "SAS_OPENCL" in os.environ: 227 240 del os.environ["SAS_OPENCL"] 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) 241 sasmodels.kernelcl.reset_environment() 234 242 event.Skip() 235 243 … … 247 255 Run sasmodels check from here and report results from 248 256 """ 249 import json250 import platform251 #import sasmodels252 253 257 #The same block of code as for OK but it is needed if we want to have 254 258 #active response to Test button … … 261 265 if "SAS_OPENCL" in os.environ: 262 266 del os.environ["SAS_OPENCL"] 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 267 sasmodels.kernelcl.reset_environment() 274 268 275 269 try: 276 from sasmodels.kernelcl import environment 277 env = environment() 270 env = sasmodels.kernelcl.environment() 278 271 clinfo = [(ctx.devices[0].platform.vendor, 279 272 ctx.devices[0].platform.version, … … 282 275 ctx.devices[0].version) 283 276 for ctx in env.context] 284 except ImportError:277 except Exception: 285 278 clinfo = None 286 279 287 280 failures = [] 288 281 tests_completed = 0 289 for test in model_tests():282 for test in sasmodels.model_test.model_tests(): 290 283 try: 291 284 test()
Note: See TracChangeset
for help on using the changeset viewer.