可以使用cublasDdot()在非gpu内存中使用blas操作吗?
Can you use cublasDdot() to use blas operations in non-GPU memory?
所以我有一个执行矩阵乘法的代码,但问题是当我使用库-lcublas和编译器nvcc时,它只返回零;但是,当我使用编译器g++和库-lblas时,只需对函数名进行一些调整,代码就可以运行得很好。
你可以使用-lcublas库从内存中执行矩阵乘法,而不是在GPU上?
下面是返回0的代码:
extern "C" //external reference to function so the code compiles
{
double cublasDdot(int *n, double *A, int *incA, double *B, int *incB);
}
//stuff happens
cout << "Calculating/printing the contents of Matrix C for ddot...n";
C[i][t]=cublasDdot(&n, partA, &incA, partB, &incB); //This thing isn't working for some reason (although it compiles just fine)
我使用以下命令编译它:nvcc program -lcublas
extern "C" //external reference to function so the code compiles
{
double ddot_(int *n, double *A, int *incA, double *B, int *incB);
}
//stuff happens
C[i][t]=ddot_(&n, partA, &incA, partB, &incB);
用g++ program -lblas
编译
cublas需要一个正常运行的CUDA GPU。
可能你没有做错误检查。在cublas手册中详细阅读如何进行错误检查。看看一些错误检查的示例代码。
一般使用cublas需要将数据传输到GPU,并将结果传回。
相关文章:
- 为什么在popback()操作之后,它仍然打印完整的矢量
- 重载操作程序时出错>>用于类中的字符串 memebr
- 对字符串进行位操作
- 我可以在 C++ 中的函数体之外进行操作吗?
- MPI突然停止了对多个核心的操作
- 如何在信号处理程序和普通函数中对全局变量进行互斥读写操作
- 对字符数组中的元素执行逐位操作
- 如何在directx/c++中进行平移/缩放操作
- 逐位操作的隐式类型转换
- 为什么一个向量上的多线程操作很慢
- 排序时无法执行交换操作.我做的时候它会崩溃.为什么
- 位移操作和位掩码未检测到重复字符
- 如何进行特定的位操作?
- 当我们进行一些操作时,应该使用什么'std::string'或'std::stringstream'?
- 字符串操作 - 字符计数
- 此代码中的操作流程是什么?C/C++.
- 复制和交换习惯用法与移动操作之间的交互
- 像union_这样的 Boost.Geometry 操作如何处理浮点类型的基本不精确性?
- 可以使用cublasDdot()在非gpu内存中使用blas操作吗?
- C++中的矩阵操作(使用 Blas/Lapack 或其他替代方案)