Can I process 'fit' with a GPU?

조회 수: 20 (최근 30일)
Kris Hoffman
Kris Hoffman 2018년 12월 7일
답변: Fernando Liozzi 2022년 9월 24일
Just tried running a test.
gX = randi(100,10,1,'gpuArray');
gY = randi(100,10,1,'gpuArray');
[a,b] = fit(gX,gY,'exp1');
gather(a,b);
and all I get is the error...
LSQCURVEFIT requires the following inputs to be of data type double: 'X0','YDATA'.
Is there any way to run 'fit' on the GPU (GTX 1080)?
Thanks.

채택된 답변

Joss Knight
Joss Knight 2018년 12월 8일
No, there isn't, but other options may be adaptable to your problem.
  댓글 수: 1
Kris Hoffman
Kris Hoffman 2018년 12월 8일
Will this become a feature in future iterations of MATLAB?

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Joss Knight
Joss Knight 2018년 12월 9일
We plan to accelerate the rate at which we provide improved coverage for gpuArray support in MATLAB Toolboxes, including Stats and Optim. Since these features are customer requested, they will be higher priority.
  댓글 수: 10
Walter Roberson
Walter Roberson 2018년 12월 11일
A lot of the time, but not necessarily in this case, when you see a fit with a range of potential values that crosses 0, such as (-0.003049, 0.002115), then what it can mean is that the results are effectively nonsense, that it was not able to decide between alternate solutions within error bounds.
You are only fitting one exponential in this case. If you were fitting the sum of two or more exponentials or (even more so) two or more guassians, then that kind of situation would probably show up. In such cases, it is common for the algorithm to pick one of the terms as being the "right" term and to try to fit it exactly while treating the other terms as effectively noise, but which of the terms gets lucky depends upon the initial condition (which is often random). The algorithm does not deliberately do this: it is just how the math works out if you do not happen to start with initial conditions in the Goldilocks Zone.
In cases that involve coefficients to an even power, then unless bounds conditions are put in place, fitting cannot tell the difference between the negative and the positive value for the coefficient; in such cases you would see an output in which negative and positive bounds are close to equal but opposite in sign (but often not exactly equal.)
Seeing outputs with confidence bounds that cross 0 should be a warning flag to check the results more carefully.
Adrian Bondy
Adrian Bondy 2019년 10월 13일
It's pretty embarrassing that essentially none of the fitting functions in matlab (for doing regression, generalized linear models, gradient descent, etc) support gpuArray inputs. gpuArrays have been part of Matlab for many years and there is no reason these functions couldn't support this input. It took me literally fifteen minutes to make glmfit support gpuArray input and it speeds up fitting by a factor of 5. The core computation for fitting linear models is a QR decomposition which is ALREADY supported to gpuArrays. SMH.

댓글을 달려면 로그인하십시오.


Fernando Liozzi
Fernando Liozzi 2022년 9월 24일
Hi, please add GPU support for train net, is toooooo slow, I prefer to use Keras in Python for this analysis, but I need Simulink and Matlab codder for put the trained neural network in a STM32 or ESP32, etc.

Fernando Liozzi
Fernando Liozzi 2022년 9월 24일
I have noticed that with one of the methods, it is very fast and it is using something from the GPU called "COPY", what is it? Tensorflow uses the 3D part. The percentage of GPU usage is always greater than 20%, but I have even seen it go up to 45%. For now, excellent.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by