When I run a simple test program for CUSPARSE, my initial call to cusparseCreate returns 1, which corresponds to CUSPARSE_STATUS_NOT_INITIALIZED. The documentation says that this return code means I should call cusparseCreate first, which would require calling cusparseCreate before itself. External Image
What does it mean when cusparseCreate returns CUSPARSE_STATUS_NOT_INITIALIZED? Is there something wrong with my CUDA setup? I just upgraded to 3.2RC, but kernels run through PyCuda execute properly, so I think it’s working.
Here is my test program:
#include <cuda_runtime.h>
#include <cusparse.h>
#include <iostream>
// A simple program to make sure CUSPARSE is working from C.
// Compile with: nvcc cusparse.cu -o cusparse -lcusparse
int main(int argc, char** argv) {
cusparseHandle_t context = 0;
std::cout << "Making context..." << std::endl;
cusparseStatus_t status = cusparseCreate(&context);
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
int cusparseVersion = 0;
std::cout << "Getting version..." << std::endl;
status = cusparseGetVersion(context, &cusparseVersion);
std::cout << "Version: " << cusparseVersion << std::endl;
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
std::cout << "Destroying context..." << std::endl;
status = cusparseDestroy(context);
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
}
When I run a simple test program for CUSPARSE, my initial call to cusparseCreate returns 1, which corresponds to CUSPARSE_STATUS_NOT_INITIALIZED. The documentation says that this return code means I should call cusparseCreate first, which would require calling cusparseCreate before itself. External Image
What does it mean when cusparseCreate returns CUSPARSE_STATUS_NOT_INITIALIZED? Is there something wrong with my CUDA setup? I just upgraded to 3.2RC, but kernels run through PyCuda execute properly, so I think it’s working.
Here is my test program:
#include <cuda_runtime.h>
#include <cusparse.h>
#include <iostream>
// A simple program to make sure CUSPARSE is working from C.
// Compile with: nvcc cusparse.cu -o cusparse -lcusparse
int main(int argc, char** argv) {
cusparseHandle_t context = 0;
std::cout << "Making context..." << std::endl;
cusparseStatus_t status = cusparseCreate(&context);
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
int cusparseVersion = 0;
std::cout << "Getting version..." << std::endl;
status = cusparseGetVersion(context, &cusparseVersion);
std::cout << "Version: " << cusparseVersion << std::endl;
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
std::cout << "Destroying context..." << std::endl;
status = cusparseDestroy(context);
std::cout << "Status: " << status << std::endl;
if(status != CUSPARSE_STATUS_SUCCESS) {
std::cout << "Failed!" << std::endl;
}
}
It turns out I installed the 3.2 CUDA runtime, but was still using the 3.1 driver. PyCuda managed to work around this somehow and run kernels, but anything using the actual C CUDA libraries was broken, including CUSPARSE.
So, if cusparseCreate returns CUSPARSE_STATUS_NOT_INITIALIZED, it means the underlying CUDA runtime isn’t working, and there is potentially a driver/runtime version mismatch.
It turns out I installed the 3.2 CUDA runtime, but was still using the 3.1 driver. PyCuda managed to work around this somehow and run kernels, but anything using the actual C CUDA libraries was broken, including CUSPARSE.
So, if cusparseCreate returns CUSPARSE_STATUS_NOT_INITIALIZED, it means the underlying CUDA runtime isn’t working, and there is potentially a driver/runtime version mismatch.