cuSolverRf 样本状态分配失败

cuSolverRf sample status alloc failed

运行 CuSolverRf sample 与示例 .mtx 文件 lap2D_5pt_n100.mtxlap3D_7pt_n20.mtx 允许程序顺利 运行。但是,当我插入自己的 .mtx 文件时,在第 8 步后出现错误:

"CUDA error at cuSolverRF.ccp:649 code=2..."

我已经将问题缩小到这里:

checkCudaErrors(cusolverRfSetupHost(
    rowsA, nnzA, 
    h_csrRowPtrA, h_csrColIndA, h_csrValA,
    nnzL, 
    h_csrRowPtrL, h_csrColIndL, h_csrValL, 
    nnzU, 
    h_csrRowPtrU, h_csrColIndU, h_csrValU, 
    h_P, 
    h_Q, 
    cusolverRfH));

哪个会跳转到

    void check(T result, char const *const func, const char *const file, int const line)
{
    if (result)
    {
        fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n",
                file, line, static_cast<unsigned int>(result), _cudaGetErrorEnum(result), func);
        DEVICE_RESET
        // Make sure we call CUDA Device Reset before exiting
        exit(EXIT_FAILURE);
    }
}

我的问题是"result"是怎么推导出来的?我可以做些什么来克服这个问题或者我做错了什么?

附加信息:我的矩阵是 196530 x 196530 和 2530798 nnz。

错误码2对应CUSOLVER_STATUS_ALLOC_FAILED:

quoting the cuSOLVER documentation:

Resource allocation failed inside the cuSolver library. This is usually caused by a cudaMalloc() failure. To correct: prior to the function call, deallocate previously allocated memory as much as possible.

这意味着无法为您的矩阵分配内存,可能是因为您的 GPU 内存已超出。尝试释放内存(如文档中所述),使用较小的输入矩阵,或使用具有更多内存的 GPU。