【发布时间】:2016-06-15 11:48:59
【问题描述】:
我想使用 cublasSgetrsBatched 函数求解带有 CuBLAS 的线性方程。 这是我的程序:
__global__ void invokeDeviceCublasSgemm(cublasStatus_t *returnValue,
int n,
const float *d_alpha,
float *d_A,
float *d_B,
const float *d_beta,
float *d_C)
{
cublasHandle_t cnpHandle;
cublasStatus_t status = cublasCreate(&cnpHandle);
if (status != CUBLAS_STATUS_SUCCESS)
{
*returnValue = status;
return;
}
int indice = 0;
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
if(i==j)
{
d_A[i*5+j] = 1;
}else
{
d_A[i*5+j] = 0;
}
d_A[i*5+j] = indice++ +1;
}
d_B[i] = i*i+2;
}
//A*At
float alpha = 1.0;
float beta = 0;
int devIpiv = 5;
int info;
cublasSgetrsBatched(cnpHandle,
CUBLAS_OP_N,
5,
1,
&d_A,
5*5,
(&devIpiv),
&d_B,
(#VERSION1)5, or (#VERSION2)1,
&info,
1);
printf("info %d ",info);
cublasDestroy(cnpHandle);
*returnValue = status;
}
此函数为 cublasSgetrsBatched #VERSION1 的第一个版本生成
info 0 !!!! device to host memory copy error
我无法复制数据但没有信息错误。
在版本 2 #VERSION2:
info -8
我不明白如何让这个函数在一个简单的线性方程上工作。
有人可以帮我吗?
【问题讨论】:
-
您能重新格式化您的代码以便我们阅读吗?