The CUBLAS documentation defines the operation in sgemm/dgemm method as follows:

C = alpha * A * B + beta * C

Suppose I have two matrices, X and Y, and would like to perform the operation X = X * Y. Therefore, for CUBLAS, I will be passing in the following parameters:

alpha = 1.0
A = X
B = Y
beta = 0.0
C = X

The idea is to overwrite X (originally an input) with the resultant matrix. I have seen some weird behavior so far, where sometimes it works, and sometimes only portions of the resultant matrix are correct. Can anyone tell me definitely if this is a poor practice? Thank you in advance!