提交 84161c84 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Nicer error message for people that abuse the sizes of the blocks.

上级 824c7c27
......@@ -445,6 +445,8 @@ static cublasStatus_t SgerBatched(cublasHandle_t handle, int m, int n,
}
}
if (grid.x * grid.y * grid.z > 65535) {
if (grid.x * grid.y > 65535)
return CUBLAS_INVALID_VALUE;
grid.z = (65535 / (grid.x * grid.y));
}
cublasGetPointerMode(handle, &mode);
......@@ -590,7 +592,16 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1],
CudaNdarray_HOST_DIMS(%(x)s)[1] *
CudaNdarray_HOST_DIMS(%(y)s)[1]);
if (err != CUBLAS_STATUS_SUCCESS) {
PyErr_SetString(PyExc_RuntimeError, "SgerBatched failed");
if (err == CUBLAS_INVALID_VALUE) {
/* The current code would be much too slow for sizes any larger
than this. */
PyErr_SetString(PyExc_ValueError,
"SgerBatched failed, probably because you have your "
"block size too big. The current limit is 65535 for "
"iSize * oSize.");
} else {
PyErr_SetString(PyExc_RuntimeError, "SgerBatched failed");
}
%(fail)s
}
}""" % dict(x=x, y=y, out=out, xIdx=xIdx, yIdx=yIdx, name=name,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论