什么是在CUDA中转置矩阵的最有效的方法? [英] What is the most efficient way to transpose a matrix in CUDA?

查看:1008
本文介绍了什么是在CUDA中转置矩阵的最有效的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 M * N 主机内存矩阵,并且在复制到设备内存时,我需要将它转换为 N * M 矩阵。有没有任何cuda(cuBLAS ...)API这样做?我在使用CUDA 4.感谢!

I have a M*N host memory matrix, and upon copying into a device memory, I need it to be transposed into a N*M matrix. Is there any cuda (cuBLAS...) API doing that? I am using CUDA 4. Thanks!

推荐答案

cublas API

cublas<t>geam()

This function performs the matrix-matrix addition/transposition
the user can transpose matrix A by setting *alpha=1 and *beta=0.  

(并指定transa运算符为CUBLAS_OP_T用于转置)

(and specifying the transa operator as CUBLAS_OP_T for transpose)

这篇关于什么是在CUDA中转置矩阵的最有效的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆