Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:06:18+00:00 2026-06-14T20:06:18+00:00

I want to do the following matrix-matrix multiplication by using cublas: cA(M by K)

  • 0

I want to do the following matrix-matrix multiplication by using cublas:

  cA(M by K) * cB(K by N) => cAout(M by N)

I assigned cA with K as the leading index, and cB with N as the leading index. According to cublas-4.0 handbook, I should do:

HANDLE_ERROR(cublasSgemm(hdl, CUBLAS_OP_N, CUBLAS_OP_N, M, K, N, &alpha, cA, K, cB, N, &beta, cAout, N));    

but it didn’t work. Instead, the following code produces the expected results by literately switching cA and cB:

HANDLE_ERROR(cublasSgemm(hdl, CUBLAS_OP_N, CUBLAS_OP_N, N, K, M, &alpha, cB, N, cA, K, &beta, cAout, N));    

The cublas version I was using is 4.1.28. Is there a convention change in the function parameters? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:06:19+00:00Added an answer on June 14, 2026 at 8:06 pm

    Recall that CUBLAS uses the column-major storage convention. Assuming these matrices are not part of some larger matrix, the leading dimension of cA is M, the leading dimension of cB is K, and the leading dimension of cAout is M. Your SGEMM call should therefore read

    HANDLE_ERROR(cublasSgemm(hdl, CUBLAS_OP_N, CUBLAS_OP_N, M, K, N, &alpha, cA, M, cB, K, &beta, cAout, M));    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a matrix without using any loop, like in the following
Continuing with my matrix multiplication question , I want to show the following expression
I have this following numpy matrix that I want to sort in ascending order
I want the following functionality using php I have a csv file. Each file
I need to make a query output Using table, I want the following report,
I did the following matrix multiplication benchmark in IronPython based on code here :
Say I have the following matrix which is vertical : {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} And I want
I want to put in a adjacency matrix the following graph: The left figure
I want to achieve the following: Have a AxBxC matrix (where A,B,C are integers).
I want to plot a confusion matrix using Pylab. The class labels along the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.