Opened 8 years ago

Last modified 8 years ago

#665 closed defect

opencl wrong for long kernels — at Version 8

Reported by: pkienzle Owned by: wojciech
Priority: major Milestone: SasView 4.1.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description (last modified by butler)

On a MacbookPro (Intel HD 4000 GPU), the 2D barbell model with length pd=0.2 radius pd=0.2 gives the wrong scattering pattern when Npts=300.

It works fine for smaller N or smaller pd.

Check other cards/other platforms.

If it is very common problem, we can fetch the results from the GPU every ½ second or so, and sum them on the CPU.

Change History (8)

comment:1 Changed 8 years ago by krzywon

Trying to fit the barbell model with polydispersity, this stack trace appeared in my sasview.log for every fit step, with the fit parameters slightly changed every time. Windows 7, Intel® HD Graphics 4600, Intel® Core™ i7-4770 CPU @ 3.40GHz.

2016-09-23 15:09:31,224 ERROR Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\bumps\fitproblem.py", line 376, in nllf
    if pparameter + pconstraint <= self.soft_limit
  File "C:\Anaconda\lib\site-packages\bumps\fitproblem.py", line 536, in model_nllf
    return sum(f.model_nllf() for f in self.models)
  File "C:\Anaconda\lib\site-packages\bumps\fitproblem.py", line 536, in <genexpr>
    return sum(f.model_nllf() for f in self.models)
  File "C:\Anaconda\lib\site-packages\bumps\fitproblem.py", line 230, in model_nllf
    return self.fitness.nllf()
  File "C:\Users\jkrzywon\PycharmProjects\sasview\src\sas\sascalc\fit\BumpsFitting.py", line 198, in nllf
    return 0.5*numpy.sum(self.residuals()**2)
  File "C:\Users\jkrzywon\PycharmProjects\sasview\src\sas\sascalc\fit\BumpsFitting.py", line 205, in residuals
    self._recalculate()
  File "C:\Users\jkrzywon\PycharmProjects\sasview\src\sas\sascalc\fit\BumpsFitting.py", line 191, in _recalculate
    = self.data.residuals(self.model.evalDistribution)
  File "C:\Users\jkrzywon\PycharmProjects\sasview\src\sas\sascalc\fit\AbstractFitEngine.py", line 367, in residuals
    self.qy_data[self.idx]])
  File "C:\Users\jkrzywon\PycharmProjects\sasmodels\sasmodels\sasview_model.py", line 537, in evalDistribution
    return self.calculate_Iq(qx, qy)
  File "C:\Users\jkrzywon\PycharmProjects\sasmodels\sasmodels\sasview_model.py", line 567, in calculate_Iq
    call_details, values, is_magnetic = make_kernel_args(calculator, pairs)
  File "C:\Users\jkrzywon\PycharmProjects\sasmodels\sasmodels\details.py", line 236, in make_kernel_args
    call_details = make_details(kernel.info, length, offset[:-1], offset[-1])
  File "C:\Users\jkrzywon\PycharmProjects\sasmodels\sasmodels\details.py", line 198, in make_details
    raise ValueError("Too many polydisperse parameters")
ValueError: Too many polydisperse parameters

                           M2.background |.........      0.001 in (0,inf)
                          M2.bell_radius |.........         40 in (0,inf)
                    M2.bell_radius.width ..|....... -9.3051e-07 in (-inf,inf)
                               M2.length |.........        400 in (0,inf)
                         M2.length.width .......|..        0.2 in (-inf,inf)
                                  M2.phi .......|..    60.0001 in (-inf,inf)
                            M2.phi.width .......|.. 7.4868e-07 in (-inf,inf)
                               M2.radius |.........         20 in (0,inf)
                         M2.radius.width .......|..        0.2 in (-inf,inf)
                                M2.scale |.........          1 in (0,inf)
                                  M2.sld .......|..          4 in (-inf,inf)
                          M2.sld_solvent .......|..   0.999999 in (-inf,inf)
                                M2.theta .......|..    60.0001 in (-inf,inf)
                          M2.theta.width ..|....... -9.82803e-07 in (-inf,inf)

comment:2 Changed 8 years ago by pkienzle

Max 4 polydisperse parameters. Need warnings in GUI if more are selected.

Instead of increasing the number of PD loops in the kernel code, switch to monte carlo integration with importance sampling when more than 4 dimensions. Do not extend the code to contain one more loop. Not only will this be slower, but it will increase code size and possibly reduce the number of q values that can be evaluated in parallel.

comment:3 Changed 8 years ago by pkienzle

Note that the original ticket may already have been fixed, but test before closing.

comment:4 Changed 8 years ago by wojciech

  • Owner set to wojciech
  • Status changed from new to assigned

comment:5 Changed 8 years ago by wojciech

Barbell with 2 polydisperisty parameters and Npts=300 returns correct diffraction pattern.
Tested on Iris™ Graphics 6100

comment:6 Changed 8 years ago by wojciech

Will be good to test it on some windows machine with GPU card before closing

comment:7 Changed 8 years ago by pkienzle

Tested again on macbook and it seems to work. Running long computations definitely slows the machine to a crawl, but does not crash it or render it completely unusable (this was typed while running the above).

Note: May want to maintain a list of supported/unsupported devices. On the Radeon R9 Nano for Windows I sometimes get speckle patterns in 2D. I also once got an incomplete integration, but was not able to reproduce it.

comment:8 Changed 8 years ago by butler

  • Description modified (diff)
Note: See TracTickets for help on using tickets.