Difference in output of find when using gpuArray
显示 更早的评论
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 |
+-----------------------------------------------------------------------------+
回答(1 个)
Edric Ellis
2015-4-27
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 个评论
Ranjan Anantharaman
2015-4-27
Edric Ellis
2015-4-27
编辑:Edric Ellis
2015-4-27
Very strange, I just tried this in R2014b on Linux (C2070) and Windows (M2075), and did not see the assertion failure... I think you should probably contact technical support to see if they can help with this.
Ranjan Anantharaman
2015-4-28
Edric Ellis
2015-4-28
I'm using Debian 7.
Ranjan Anantharaman
2015-4-28
编辑:Ranjan Anantharaman
2015-4-28
Ranjan Anantharaman
2015-4-29
Edric Ellis
2015-4-29
Still very mysterious - especially since the computation for the elements of a2 is performed on the host, and then the value simply sent to the GPU - and that value is a logical which gets converted to a double. What's the output of running that code and then doing:
format hex
unique(a1(:))
?
Ranjan Anantharaman
2015-4-29
Edric Ellis
2015-4-30
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
2015-5-1
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel and Cloud 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!