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 8972361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:12:04+00:00 2026-06-15T18:12:04+00:00

Say I have a matrix with a dimension of A*B on GPU, where B

  • 0

Say I have a matrix with a dimension of A*B on GPU, where B (number of columns) is the leading dimension assuming a C style. Is there any method in CUDA (or cublas) to transpose this matrix to FORTRAN style, where A (number of rows) becomes the leading dimension?

It is even better if it could be transposed during host->device transfer while keep the original data unchanged.

  • 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-15T18:12:06+00:00Added an answer on June 15, 2026 at 6:12 pm

    The CUDA SDK includes a matrix transpose, you can see here examples of code on how to implement one, ranging from a naive implementation to optimized versions.

    For example:

    Naïve transpose

    __global__ void transposeNaive(float *odata, float* idata,
    int width, int height, int nreps)
    {
        int xIndex = blockIdx.x*TILE_DIM + threadIdx.x;
        int yIndex = blockIdx.y*TILE_DIM + threadIdx.y;
        int index_in = xIndex + width * yIndex;
        int index_out = yIndex + height * xIndex;
    
        for (int r=0; r < nreps; r++)
        {
            for (int i=0; i<TILE_DIM; i+=BLOCK_ROWS)
            {
              odata[index_out+i] = idata[index_in+i*width];
            }
        }
    }
    

    Like talonmies had point out you can specify if you want operate the matrix as transposed or not, in cublas matrix operations eg.: for cublasDgemm() where C = a * op(A) * op(B) + b * C, assuming you want to operate A as transposed (A^T), on the parameters you can specify if it is (‘N’ normal or ‘T’ transposed)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a 256 by 256 matrix. I would like to replace any
Say I have a matrix A with 3 columns c1 , c2 and c3
I have a 3d matrix grid_z0 , whose dimension are (let's say) 50x25x36. Each
Let's say I have a matrix x which contains 10 rows and 2 columns.
Say I have a matrix with 3 columns: c1 , c2 , c3 ,
Let's say I have a matrix that has X rows and Y columns. The
Say, I have a matrix m with 2 rows and 3 columns, together with
Let's say I have a matrix with all 0's with the exception of the
So let's say I have a matrix, mdat and I only know the index
Say I have the following matrix: A = randi(10, [6 3]) 7 10 3

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.