Changeset 9863343 in sasview for src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
- Timestamp:
- Oct 25, 2017 7:58:46 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- c31d41e7
- Parents:
- 37be27f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
r37be27f r9863343 6 6 import platform 7 7 8 import sas.qtgui.Utilities.GuiUtils as GuiUtils 8 9 from PyQt4 import QtGui, QtCore, QtWebKit 9 10 from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions … … 38 39 self.setupUi(self) 39 40 self.addOpenCLOptions() 41 self.setFixedSize(self.size()) 40 42 self.createLinks() 41 43 … … 61 63 # Expand group and shift items down as more are added 62 64 self.openCLCheckBoxGroup.resize(391, 60 + i) 63 self. label.setGeometry(QtCore.QRect(20, 90 + i, 391, 37))65 self.warningMessage.setGeometry(QtCore.QRect(20, 90 + i, 391, 37)) 64 66 self.okButton.setGeometry(QtCore.QRect(20, 127 + i, 93, 28)) 65 67 self.resetButton.setGeometry(QtCore.QRect(120, 127 + i, 93, 28)) … … 73 75 Link user interactions to function calls 74 76 """ 75 self.testButton.clicked.connect( lambda: self.testButtonClicked())76 self.helpButton.clicked.connect( lambda: self.helpButtonClicked())77 self.testButton.clicked.connect(self.testButtonClicked) 78 self.helpButton.clicked.connect(self.helpButtonClicked) 77 79 for item in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 78 item.clicked.connect( lambda: self.checked())80 item.clicked.connect(self.checked) 79 81 80 82 def checked(self): … … 151 153 } 152 154 153 msg_info = 'OpenCL tests results'154 155 155 msg = str(tests_completed) + ' tests completed.\n' 156 156 if len(failures) > 0: … … 172 172 msg += "\nOpenCL driver: " 173 173 msg += json.dumps(info['opencl']) + "\n" 174 GPUTestResults(self, msg , msg_info)174 GPUTestResults(self, msg) 175 175 176 176 def helpButtonClicked(self): … … 178 178 Open the help menu when the help button is clicked 179 179 """ 180 tree_location = "user/sasgui/perspectives/fitting/gpu_setup.html" 181 anchor = "#device-selection" 180 help_location = GuiUtils.HELP_DIRECTORY_LOCATION 181 help_location += "/user/sasgui/perspectives/fitting/gpu_setup.html" 182 help_location += "#device-selection" 182 183 self.helpView = QtWebKit.QWebView() 183 help_location = tree_location + anchor184 184 self.helpView.load(QtCore.QUrl(help_location)) 185 185 self.helpView.show() … … 211 211 OpenCL Dialog to modify the OpenCL options 212 212 """ 213 def __init__(self, parent, msg , title):213 def __init__(self, parent, msg): 214 214 super(GPUTestResults, self).__init__(parent) 215 215 self.setupUi(self) 216 216 self.resultsText.setText(_translate("GPUTestResults", msg, None)) 217 self.setFixedSize(self.size()) 217 218 self.open() 218 219 … … 223 224 """ 224 225 clinfo = [] 225 platforms = []226 cl_platforms = [] 226 227 try: 227 228 import pyopencl as cl 228 platforms = cl.get_platforms()229 cl_platforms = cl.get_platforms() 229 230 except ImportError: 230 231 print("pyopencl import failed. Using only CPU computations") 231 232 232 233 p_index = 0 233 for platform inplatforms:234 for cl_platform in cl_platforms: 234 235 d_index = 0 235 devices =platform.get_devices()236 for device in devices:237 if len( devices) > 1 and len(platforms) > 1:236 cl_platforms = cl_platform.get_devices() 237 for cl_platform in cl_platforms: 238 if len(cl_platforms) > 1 and len(cl_platforms) > 1: 238 239 combined_index = ":".join([str(p_index), str(d_index)]) 239 elif len( platforms) > 1:240 elif len(cl_platforms) > 1: 240 241 combined_index = str(p_index) 241 242 else: 242 243 combined_index = str(d_index) 243 clinfo.append((combined_index, ":".join([ platform.name,244 device.name])))244 clinfo.append((combined_index, ":".join([cl_platform.name, 245 cl_platform.name]))) 245 246 d_index += 1 246 247 p_index += 1
Note: See TracChangeset
for help on using the changeset viewer.