Changeset b2964ef in sasview for src/sas/sasgui
- Timestamp:
- Apr 2, 2019 5:42:56 AM (6 years ago)
- Branches:
- master
- Parents:
- fa307dd (diff), 4688acf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Wojciech Potrzebowski <Wojciech.Potrzebowski@…> (04/02/19 05:42:56)
- git-committer:
- GitHub <noreply@…> (04/02/19 05:42:56)
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 4 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/gpu_options.py
r895703d r4688acf 16 16 import wx 17 17 18 # TODO: move device query functions to sasmodels 18 19 try: 19 20 import pyopencl as cl … … 24 25 import sasmodels.model_test 25 26 import sasmodels.sasview_model 27 from sasmodels.generate import F32, F64 26 28 27 29 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 28 30 29 31 logger = logging.getLogger(__name__) 30 31 32 32 33 33 class CustomMessageBox(wx.Dialog): … … 76 76 77 77 self.SetAutoLayout(True) 78 self.ShowModal()79 self.Destroy()80 78 81 79 … … 144 142 test_btn = wx.Button(self, test_id, 'Test') 145 143 test_btn.SetToolTipString("Test if models compile on the given infrastructure") 144 self.test_btn = test_btn 146 145 147 146 self.Bind(wx.EVT_BUTTON, self.on_OK, accept_btn) … … 179 178 :return: 180 179 """ 180 # TODO: Include cuda platforms if available. 181 181 clinfo = [] 182 182 platforms = [] … … 257 257 #The same block of code as for OK but it is needed if we want to have 258 258 #active response to Test button 259 259 260 no_opencl_msg = False 260 261 if self.sas_opencl: … … 265 266 if "SAS_OPENCL" in os.environ: 266 267 del os.environ["SAS_OPENCL"] 267 sasmodels.sasview_model.reset_environment() 268 # CRUFT: next version of reset_environment() will return env 269 env = sasmodels.sasview_model.reset_environment() 268 270 269 271 try: 270 272 env = sasmodels.kernelcl.environment() 271 clinfo = [(ctx.devices[0].platform.vendor, 272 ctx.devices[0].platform.version, 273 ctx.devices[0].vendor, 274 ctx.devices[0].name, 275 ctx.devices[0].version) 276 for ctx in env.context] 277 except Exception: 278 clinfo = None 273 clinfo = {} 274 if env.context[F64] is None: 275 clinfo['double'] = "None" 276 else: 277 ctx64 = env.context[F64].devices[0] 278 clinfo['double'] = ", ".join(( 279 ctx64.platform.vendor, 280 ctx64.platform.version, 281 ctx64.vendor, 282 ctx64.name, 283 ctx64.version)) 284 if env.context[F32] is None: 285 clinfo['single'] = "None" 286 else: 287 ctx32 = env.context[F32].devices[0] 288 clinfo['single'] = ", ".join(( 289 ctx32.platform.vendor, 290 ctx32.platform.version, 291 ctx32.vendor, 292 ctx32.name, 293 ctx32.version)) 294 # If the same device is used for single and double precision, then 295 # say so. Whether double is the same as single or single is the 296 # same as double depends on the order they are listed below. 297 if env.context[F32] == env.context[F64]: 298 clinfo['double'] = "same as single precision" 299 except Exception as exc: 300 logger.debug("exc %s", str(exc)) 301 clinfo = {'double': "None", 'single': "None"} 302 303 msg = "\nPlatform Details:\n\n" 304 msg += "Sasmodels version: " 305 msg += sasmodels.__version__ + "\n" 306 msg += "\nPlatform used: " 307 msg += json.dumps(platform.uname()) + "\n" 308 if no_opencl_msg: 309 msg += "\nOpenCL driver: None\n" 310 else: 311 msg += "\nOpenCL driver:\n" 312 msg += " single precision: " + clinfo['single'] + "\n" 313 msg += " double precision: " + clinfo['double'] + "\n" 314 315 msg_title = 'OpenCL tests results' 316 running = msg + "\nRunning tests. This may take several minutes.\n\n" 317 msg_dialog = CustomMessageBox(self.panel1, running, msg_title) 318 msg_dialog.Show() 279 319 280 320 failures = [] 281 321 tests_completed = 0 282 for test in sasmodels.model_test.model_tests(): 322 self.test_btn.Disable() 323 tests = sasmodels.model_test.make_suite('opencl', ['all']) 324 for test in tests: 283 325 try: 284 test() 285 except Exception: 286 failures.append(test.description) 287 326 wx.Yield() 327 test.run_all() 328 msg_dialog.text.AppendText('.') 329 except Exception as exc: 330 logger.debug("%s failed with %s", test.test_name, str(exc)) 331 msg_dialog.text.AppendText('\nFail: ' + test.test_name) 332 failures.append(test.test_name) 288 333 tests_completed += 1 289 290 info = { 291 'version': sasmodels.__version__, 292 'platform': platform.uname(), 293 'opencl': clinfo, 294 'failing tests': failures, 295 } 296 297 msg_info = 'OpenCL tests results' 298 299 msg = str(tests_completed)+' tests completed.\n' 300 if len(failures) > 0: 301 msg += str(len(failures))+' tests failed.\n' 302 msg += 'Failing tests: ' 303 msg += json.dumps(info['failing tests']) 304 msg += "\n" 305 else: 306 msg += "All tests passed!\n" 307 308 msg += "\nPlatform Details:\n\n" 309 msg += "Sasmodels version: " 310 msg += info['version']+"\n" 311 msg += "\nPlatform used: " 312 msg += json.dumps(info['platform'])+"\n" 313 if no_opencl_msg: 314 msg += "\nOpenCL driver: None" 315 else: 316 msg += "\nOpenCL driver: " 317 msg += json.dumps(info['opencl'])+"\n" 318 319 CustomMessageBox(self.panel1, msg, msg_info) 334 # TODO: Put a stop button in CustomDialog and test it here. 335 #if tests_completed > 5: break 336 337 status = 'Failed %d of %d' % (len(failures), tests_completed) 338 msg_dialog.text.AppendText('\n\n' + status + '\n') 339 self.test_btn.Enable() 340 msg_dialog.ShowModal() 341 msg_dialog.Destroy() 320 342 321 343 def on_help(self, event): -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
rb7ce5ad rfa307dd 42 42 * *Ellipsoid* - ellipsoidal shapes (oblate,prolate, core shell, etc) 43 43 * *Parellelepiped* - as the name implies 44 * *Sphere* - s heroidal shapes (sphere, core multishell, vesicle, etc)44 * *Sphere* - spheroidal shapes (sphere, core multishell, vesicle, etc) 45 45 * *Lamellae* - lamellar shapes (lamellar, core shell lamellar, stacked 46 46 lamellar, etc) … … 61 61 on the *Description* button to the right. 62 62 63 Product Models 64 ^^^^^^^^^^^^^^ 65 66 S(Q) models can be combined with many models in the other categories to 67 generate what SasView calls "product models". The combination can be done by 68 one of two methods, but how they behave is slightly different. 69 70 The first, most straightforward, method is simply to use the S(Q) drop-down in 71 the FitPage: 72 73 .. figure:: p_and_s_buttons.png 74 75 This example would then generate a product model with the following parameters: 76 77 .. figure:: p_and_s_buttons_parameters.png 78 79 The other method is to use the :ref:`Sum|Multi(p1,p2)` tool under Fitting > 80 Plugin Model Operations: 81 82 .. figure:: p_and_s_sum_model.png 83 84 This creates a product model with the following parameters: 85 86 .. figure:: p_and_s_sum_model_parameters.png 87 88 As can be seen, the second method has produced a product model with an extra 89 parameter: *radius_effective*. This is the radial distance determining the 90 range of the $S(Q)$ interaction and may, or may not, be the same as the 91 *radius*, in this example, depending on the concentration of the system. In 92 other systems, *radius_effective* may depend on the particle form (shape). 93 94 See :ref:`Product_Models` for more information. 95 63 96 Show 1D/2D 64 97 ^^^^^^^^^^ … … 119 152 120 153 For a complete list of all the library models available in SasView, see 121 the `Model Documentation <../../../ index.html>`_ .154 the `Model Documentation <../../../sasgui/perspectives/fitting/models/index.html>`_ . 122 155 123 156 It is also possible to add your own models. … … 216 249 Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once 217 250 a P(Q) model has been selected). 251 252 .. _Sum|Multi(p1,p2): 218 253 219 254 Sum|Multi(p1,p2)
Note: See TracChangeset
for help on using the changeset viewer.