- Timestamp:
- Apr 2, 2019 8:42:19 AM (6 years ago)
- Branches:
- ESS_GUI_opencl
- Children:
- f38d027
- Parents:
- f994f188
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
r33c0561 re0d5b63 10 10 import sasmodels.model_test 11 11 import sasmodels.kernelcl 12 from sasmodels.generate import F32, F64 12 13 13 14 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 112 113 if "SAS_OPENCL" in os.environ: 113 114 del os.environ["SAS_OPENCL"] 114 # Sasmodels kernelcl doesn't exist when initiated with None115 sasmodels. kernelcl.reset_environment()115 # CRUFT: next version of reset_environment() will return env 116 sasmodels.sasview_model.reset_environment() 116 117 return no_opencl_msg 117 118 … … 122 123 123 124 no_opencl_msg = self.set_sas_open_cl() 124 125 # Only import when tests are run126 from sasmodels.model_test import model_tests127 125 128 126 try: 129 127 env = sasmodels.kernelcl.environment() 130 clinfo = [(ctx.devices[0].platform.vendor, 131 ctx.devices[0].platform.version, 132 ctx.devices[0].vendor, 133 ctx.devices[0].name, 134 ctx.devices[0].version) 135 for ctx in env.context] 136 except Exception: 137 clinfo = None 128 clinfo = {} 129 if env.context[F64] is None: 130 clinfo['double'] = "None" 131 else: 132 ctx64 = env.context[F64].devices[0] 133 clinfo['double'] = ", ".join(( 134 ctx64.platform.vendor, 135 ctx64.platform.version, 136 ctx64.vendor, 137 ctx64.name, 138 ctx64.version)) 139 if env.context[F32] is None: 140 clinfo['single'] = "None" 141 else: 142 ctx32 = env.context[F32].devices[0] 143 clinfo['single'] = ", ".join(( 144 ctx32.platform.vendor, 145 ctx32.platform.version, 146 ctx32.vendor, 147 ctx32.name, 148 ctx32.version)) 149 # If the same device is used for single and double precision, then 150 # say so. Whether double is the same as single or single is the 151 # same as double depends on the order they are listed below. 152 if env.context[F32] == env.context[F64]: 153 clinfo['double'] = "same as single precision" 154 except Exception as exc: 155 logger.debug("exc %s", str(exc)) 156 clinfo = {'double': "None", 'single': "None"} 138 157 139 158 failures = [] 140 159 tests_completed = 0 141 for test in model_tests(): 160 model_tests = sasmodels.model_test.make_suite('opencl', ['all']) 161 for test in model_tests: 142 162 try: 143 test ()163 test.run_all() 144 164 except Exception: 145 165 failures.append(test.description) 146 147 166 tests_completed += 1 148 167 … … 150 169 'version': sasmodels.__version__, 151 170 'platform': platform.uname(), 152 'opencl': clinfo, 171 'opencl_single': clinfo['single'], 172 'opencl_double': clinfo['double'], 153 173 'failing tests': failures, 154 174 } … … 172 192 else: 173 193 msg += "\nOpenCL driver: " 174 msg += json.dumps(info['opencl']) + "\n" 194 msg += " single precision: " + json.dumps(info['opencl_single']) + "\n" 195 msg += " double precision: " + json.dumps(info['opencl_double']) + "\n" 175 196 GPUTestResults(self, msg) 176 197
Note: See TracChangeset
for help on using the changeset viewer.