Question on numpy style addition in pycuda gpuarray matrix #329
Unanswered
SuperbTUM
asked this question in
Troubleshooting
Replies: 1 comment
-
For now, you need to make sure that the strides match on arrays that you add together. PyCUDA should probably do this for you behind the scenes. PRs welcome! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found out when implementing matrix addition with numpy style
+
, there is a significant loss in precision and moreover, a few elements returned wrong answers, but once I flattened the matrix to vector and did vector addition, everything went right. This issue happens after completing two sets of (1000, 1000) * (1000, 1000) matrix multiplication with cublas Sgemm (data type is float32 and I think this will return a correct result, at least I tried) and add them in elementwise style with a simple symbol +. I checked all the intermediate results by transferring the results from device to host and comparing them with numpy.allclose().Beta Was this translation helpful? Give feedback.
All reactions