xiaozhenBoy / cudamat

Automatically exported from code.google.com/p/cudamat
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Sum gives wrong result #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

import numpy as np

x = np.array(np.random.random((100, 100)), dtype=np.float32)
x_sum = x.sum(axis=1)

import cudamat as cm
cm.cublas_init()

y = cm.CUDAMatrix(x)
y_sum = y.sum(axis=1).asarray()

print np.abs(x_sum - y_sum).sum()

z = cm.CUDAMatrix(x)
z_sum = z.asarray().sum(axis=1)

print np.abs(x_sum - z_sum).sum()

What is the expected output? What do you see instead?

Two numbers near zero.

What version of the product are you using? On what operating system?

commit af7d9cabf39b9232d3f5aac648a721fd54ea9acc

all unit tests pass!

Ubuntu 12.04.5 LTS \n \l 64 bit

Please provide any additional information below.

Python 2.7.3

+------------------------------------------------------+                       
| NVIDIA-SMI 340.29     Driver Version: 340.29         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 570     Off  | 0000:01:00.0     N/A |                  N/A |
| 42%   51C    P0    N/A /  N/A |      4MiB /  1279MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Compute processes:                                               GPU Memory |
|  GPU       PID  Process name                                     Usage      |
|=============================================================================|
|    0            Not Supported                                               |
+-----------------------------------------------------------------------------+

Original issue reported on code.google.com by tas...@gmail.com on 24 Jan 2015 at 1:16