- Timestamp:
- Oct 31, 2018 6:34:14 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 671d2fc8
- Parents:
- 04e1c80
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
rdb05c44 r8479735 2 2 import os 3 3 import sys 4 import sasmodels5 4 import json 6 5 import platform 7 6 import webbrowser 7 import logging 8 9 import sasmodels 10 import sasmodels.model_test 11 import sasmodels.kernelcl 8 12 9 13 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 26 30 return QtWidgets.QApplication.translate(context, text, disambig) 27 31 32 logger = logging.getLogger(__name__) 28 33 29 34 class GPUOptions(QtWidgets.QDialog, Ui_GPUOptions): … … 106 111 del os.environ["SAS_OPENCL"] 107 112 # Sasmodels kernelcl doesn't exist when initiated with None 108 if 'sasmodels.kernelcl' in sys.modules: 109 sasmodels.kernelcl.ENV = None 110 from importlib import reload # assumed Python > 3.3 111 reload(sasmodels.core) 113 sasmodels.kernelcl.reset_environment() 112 114 return no_opencl_msg 113 115 … … 123 125 124 126 try: 125 from sasmodels.kernelcl import environment 126 env = environment() 127 env = sasmodels.kernelcl.environment() 127 128 clinfo = [(ctx.devices[0].platform.vendor, 128 129 ctx.devices[0].platform.version, … … 131 132 ctx.devices[0].version) 132 133 for ctx in env.context] 133 except ImportError:134 except Exception: 134 135 clinfo = None 135 136 … … 222 223 clinfo = [] 223 224 cl_platforms = [] 225 224 226 try: 225 227 import pyopencl as cl 226 cl_platforms = cl.get_platforms()227 228 except ImportError: 228 print("pyopencl import failed. Using only CPU computations") 229 except cl.LogicError as e: 230 print(e.value) 229 cl = None 230 231 if cl is None: 232 logger.warn("Unable to import the pyopencl package. It may not " 233 "have been installed. If you wish to use OpenCL, try " 234 "running pip install --user pyopencl") 235 else: 236 try: 237 cl_platforms = cl.get_platforms() 238 except cl.LogicError as err: 239 logger.warn("Unable to fetch the OpenCL platforms. This likely " 240 "means that the opencl drivers for your system are " 241 "not installed.") 242 logger.warn(err) 231 243 232 244 p_index = 0
Note: See TracChangeset
for help on using the changeset viewer.