Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sgemm 与cublas求的结果不同 #13

Open
952480831 opened this issue May 27, 2023 · 6 comments
Open

sgemm 与cublas求的结果不同 #13

952480831 opened this issue May 27, 2023 · 6 comments

Comments

@952480831
Copy link

当K=64,128等的时候,结果不同。
例如:
size_t M = 8000;
size_t K = 64;
size_t N = 8000;
image

@952480831
Copy link
Author

您好,
size_t M = 256;
size_t K =64;
size_t N = 512;
的结果也是不同的

@Liu-xiandong
Copy link
Owner

您好, size_t M = 256; size_t K =64; size_t N = 512; 的结果也是不同的

请问是哪个版本的sgemm呢?

@952480831
Copy link
Author

您好, size_t M = 256; size_t K =64; size_t N = 512; 的结果也是不同的

请问是哪个版本的sgemm呢?

您好,是master分支下面的sgemm/sgemm_v3.cu和sgemm_v1.cu。

@Liu-xiandong
Copy link
Owner

您好, size_t M = 256; size_t K =64; size_t N = 512; 的结果也是不同的

请问是哪个版本的sgemm呢?

您好,是master分支下面的sgemm/sgemm_v3.cu和sgemm_v1.cu。

非常感谢,我后续验证一下

@WSean2020
Copy link

您好, size_t M = 256; size_t K =64; size_t N = 512; 的结果也是不同的

请问是哪个版本的sgemm呢?

您好,是master分支下面的sgemm/sgemm_v3.cu和sgemm_v1.cu。

非常感谢,我后续验证一下

问题出在这,最后一个参数应该是M而不是N。
cublasSgemm (blas_handle, CUBLAS_OP_T, CUBLAS_OP_T,
M, N, K, &alpha,
d_A, K, d_B, N, &beta, d_C, N
);

@WSean2020
Copy link

当K=64,128等的时候,结果不同。 例如: size_t M = 8000; size_t K = 64; size_t N = 8000; image

因为M=N=8000除以bm=bn=128不整除,改成bm=bn=64试试,是对的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants