Filter function returns different results on different GPUs

1 Ansicht (letzte 30 Tage)
Ziad Ali
Ziad Ali am 12 Mai 2022
Bearbeitet: Matt J am 12 Mai 2022
Hello,
I'm running into an issue where the built-in filter function returns different results on two different machines. One machine is running MATLAB 2022a and has a GeForce RTX 3080 Ti, the other is running 2018b and has a GeForce GTX 1070 Ti. The code being run to both is the line below - in each case, b1, a1, and dataRAW are the same, but filter returns different values.
datr = filter(b1, a1, dataRAW)
I think the source of the error has to do with the fact that dataRAW is a gpuArray object. In the code below, datr is the result of the filter function on the RTX PC, and dataRAW is the input data on the GTX PC. The first line returns false and the second returns true when both are run on the GTX PC.
isequal(filter(b1, a1, dataRAW), datr)
isequal(filter(b1, a1, gather(dataRAW)), datr)
Any ideas as to if/why the gpu may be creating a discrepancy here? The error between the results is quite large - the greatest difference is about 0.1755 which is not negligible for my application. Please let me know if I can clarify anything. Thanks!
  5 Kommentare
Matt J
Matt J am 12 Mai 2022
I suggest attaching one .mat file containing a1, b1, dataRaw so we can test for ourselves.
Ziad Ali
Ziad Ali am 12 Mai 2022
Sure, this file contains a1, b1, and a truncated dataRAW (the whole thing exceeds the 5 mb limit but this smaller version still generates the same issue).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 12 Mai 2022
Bearbeitet: Matt J am 12 Mai 2022
Use double floating point, instead of single floating point.
load('kilo_vars.mat')
res1=filter(b1, a1, dataraw);
res2=filter(b1, a1, gather(dataraw));
mismatch=max(abs(res1-res2))
mismatch =
gpuArray single
0.0174
dataraw=double(dataraw);
res1=filter(b1, a1, dataraw);
res2=filter(b1, a1, gather(dataraw));
mismatch=max(abs(res1-res2))
mismatch =
3.6103e-11

Weitere Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by