Difference in output of find when using gpuArray

3 Ansichten (letzte 30 Tage)
Ranjan Anantharaman
Ranjan Anantharaman am 27 Apr. 2015
Hello,
I have this piece of code:
a = zeros(12,12,12);
for i=1:12, for j=1:12, for k=1:12
a(i,j,k)=((i-5)^2+(j-6)^2+(k-7)^2)<6;
end, end, end
b = find(a);
Now I've done the same thing using gpuArray.zeros instead of zeros, and I find that the output of the find function is different. b is of size 57x1. The output of the gpuArray version (call it b1) is of size 134x1. Also, the first 57 entries in b and b1 are the same. After that, there are a bunch of zeros and some other numbers. Any idea why the find function seems to be misbehaving for gpuArray?
Thanks in advance, Ranjan
EDIT: Here's some version info just in case it helps CUDA VERSION: 6.5
the command nvidia-smi returns this:
+------------------------------------------------------+
| NVIDIA-SMI 346.47 Driver Version: 346.47 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla C2050 Off | 0000:05:00.0 Off | 0 |
| 52% 87C P0 N/A / N/A | 79MiB / 2687MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 29631 C /usr/local/MATLAB/R2014b/bin/glnxa64/MATLAB 71MiB |
+-----------------------------------------------------------------------------+

Antworten (1)

Edric Ellis
Edric Ellis am 27 Apr. 2015
I tried this in R2015a using a Tesla C2070 GPU and found no difference.
a1 = gpuArray.zeros(12,12,12);
a2 = zeros(12,12,12);
for i=1:12, for j=1:12, for k=1:12
a1(i,j,k)=((i-5)^2+(j-6)^2+(k-7)^2)<6;
a2(i,j,k)=((i-5)^2+(j-6)^2+(k-7)^2)<6;
end, end, end
b1 = find(a1);
b2 = find(a2);
% The following assertion passes
assert(isequal(b1, b2))
What release of MATLAB are you using, and what GPU device?
  10 Kommentare
Edric Ellis
Edric Ellis am 30 Apr. 2015
Those values 0020000000000000 are giving the odd results. It's very strange to me that the error is a single bit. Is that really what unique returned? As you can clearly see, there are duplicate values in there...
Ranjan Anantharaman
Ranjan Anantharaman am 1 Mai 2015
Yes, that's the output. I just double checked.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by