Changeset 14fa542 in sasview
- Timestamp:
- Oct 24, 2017 8:54:24 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:
- a6cd8d1
- Parents:
- 06ce180
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r06ce180 r14fa542 63 63 64 64 # GPU Options 65 self.gpu_options_widget = GPUOptions( )65 self.gpu_options_widget = GPUOptions(self) 66 66 67 67 self.menu_manager = ModelUtilities.ModelManager() -
src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
r06ce180 r14fa542 1 1 # global 2 import sys3 import os4 import types5 2 6 from PyQt4 import QtCore 7 from PyQt4 import QtGui 8 from PyQt4 import QtWebKit 3 from PyQt4 import QtGui, QtCore 9 4 from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions 10 5 11 from bumps import fitters 12 import bumps.options 6 try: 7 _fromUtf8 = QtCore.QString.fromUtf8 8 except AttributeError: 9 def _fromUtf8(s): 10 return s 13 11 14 # Set the default optimizer 15 fitters.FIT_DEFAULT_ID = 'lm' 12 try: 13 _encoding = QtGui.QApplication.UnicodeUTF8 14 def _translate(context, text, disambig): 15 return QtGui.QApplication.translate(context, text, disambig, _encoding) 16 except AttributeError: 17 def _translate(context, text, disambig): 18 return QtGui.QApplication.translate(context, text, disambig) 16 19 17 20 … … 25 28 self.setupUi(self) 26 29 30 # Get list of openCL options and add to GUI 31 cl_tuple = self._get_clinfo() 32 i = 0 33 for title, descr in cl_tuple: 34 button = QtGui.QRadioButton(self.openCLButtonGroup) 35 button.setGeometry(20, 20 + i, 351, 30) 36 button.setObjectName(_fromUtf8(title)) 37 button.setText(_translate("GPUOptions", descr, None)) 38 # Expand group and shift items down as more are added 39 self.openCLButtonGroup.resize(391, 60 + i) 40 self.pushButton.setGeometry(QtCore.QRect(220, 90 + i, 93, 28)) 41 self.TestButton.setGeometry(QtCore.QRect(20, 90 + i, 193, 28)) 42 self.pushButton_2.setGeometry(QtCore.QRect(320, 90 + i, 93, 28)) 43 self.resize(440, 130 + i) 44 i += 30 27 45 28 def main(): 29 app = QtGui.QApplication(sys.argv) 46 def _get_clinfo(self): 47 """ 48 Reading in information about available OpenCL infrastructure 49 :return: 50 """ 51 clinfo = [] 52 platforms = [] 53 try: 54 import pyopencl as cl 55 platforms = cl.get_platforms() 56 except ImportError: 57 print("pyopencl import failed. Using only CPU computations") 30 58 31 w = GPUOptions() 32 w.show() 59 p_index = 0 60 for platform in platforms: 61 d_index = 0 62 devices = platform.get_devices() 63 for device in devices: 64 if len(devices) > 1 and len(platforms) > 1: 65 combined_index = ":".join([str(p_index), str(d_index)]) 66 elif len(platforms) > 1: 67 combined_index = str(p_index) 68 else: 69 combined_index = str(d_index) 70 clinfo.append((combined_index, ":".join([platform.name, device.name]))) 71 d_index += 1 72 p_index += 1 33 73 34 sys.exit(app.exec_()) 35 36 if __name__ == '__main__': 37 main() 74 clinfo.append(("None", "No OpenCL")) 75 return clinfo -
src/sas/qtgui/Perspectives/Fitting/UI/GPUOptionsUI.ui
r06ce180 r14fa542 8 8 <y>0</y> 9 9 <width>440</width> 10 <height>1 63</height>10 <height>178</height> 11 11 </rect> 12 12 </property> … … 18 18 <rect> 19 19 <x>220</x> 20 <y>1 10</y>20 <y>140</y> 21 21 <width>93</width> 22 22 <height>28</height> … … 31 31 <rect> 32 32 <x>20</x> 33 <y>1 10</y>33 <y>140</y> 34 34 <width>193</width> 35 35 <height>28</height> … … 44 44 <rect> 45 45 <x>320</x> 46 <y>1 10</y>46 <y>140</y> 47 47 <width>93</width> 48 48 <height>28</height> … … 53 53 </property> 54 54 </widget> 55 <widget class="Q Widget" name="gridLayoutWidget">55 <widget class="QGroupBox" name="openCLButtonGroup"> 56 56 <property name="geometry"> 57 57 <rect> 58 58 <x>20</x> 59 <y> 10</y>59 <y>20</y> 60 60 <width>391</width> 61 <height> 91</height>61 <height>111</height> 62 62 </rect> 63 63 </property> 64 <layout class="QGridLayout" name="OpenCLDialogOptionsSection"> 65 <item row="0" column="0"> 66 <widget class="QRadioButton" name="AvailableOpenCLOptions"> 67 <property name="text"> 68 <string>None</string> 69 </property> 70 <property name="checked"> 71 <bool>true</bool> 72 </property> 73 </widget> 74 </item> 75 </layout> 64 <property name="title"> 65 <string>Available OpenCL Options</string> 66 </property> 76 67 </widget> 77 68 </widget>
Note: See TracChangeset
for help on using the changeset viewer.