GETRF Runtime error <11>

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

GETRF Runtime error <11>

Postby just_jake » Wed Feb 16, 2011 4:13 am

I have problems with Lu decomposition, runtime error 11 for culaDeviceSgetrf
Use cuda 3.2, cula R10, Gt 240

I will thankful for help

Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <cula.h>
#include <culapack.h>
#include <culapackdevice.h>
#include <cuda_runtime.h>
#include <cuda.h>


FILE *stream;

void checkStatus(culaStatus status)
{
    if(!status)
        return;

    if(status == culaArgumentError)
        printf("Invalid value for parameter %d\n", culaGetErrorInfo());
    else if(status == culaDataError)
        printf("Data error (%d)\n", culaGetErrorInfo());
    else if(status == culaBlasError)
        printf("Blas error (%d)\n", culaGetErrorInfo());
    else if(status == culaRuntimeError)
        printf("Runtime error (%d)\n", culaGetErrorInfo());
    else
        printf("%s\n", culaGetStatusString(status));

    culaShutdown();
    exit(EXIT_FAILURE);
}


void checkCudaError(cudaError_t err)
{
    if(!err)
        return;

    printf("%s\n", cudaGetErrorString(err));

    culaShutdown();
    exit(EXIT_FAILURE);
}


int main(int argc, char** argv)
{

    int M = 8;
    int N = M;

    cudaError_t err;
    culaStatus status;

    // point to host memory
    float* A = NULL;
    int* IPIV = NULL;

    // point to device memory
    float* Ad = NULL;
    int* IPIVd = NULL;

   float buf;   
   int i, it;

   cudaEvent_t start_GPU;
   cudaEvent_t  stop_GPU;
   float gpuTime_GPU;

   printf("Allocating Matrices\n");
    A = (float*)malloc(M*N*sizeof(float));
    IPIV = (int*)malloc(N*sizeof(int));
    if(!A || !IPIV)
        exit(EXIT_FAILURE);

    err = cudaMalloc((void**)&Ad, M*N*sizeof(float));
    checkCudaError(err);

    err = cudaMalloc((void**)&IPIVd, N*sizeof(int));
    checkCudaError(err);

    printf("Initializing CULA\n");
    status = culaInitialize();
    checkStatus(status);


   fopen_s(&stream, "8.8.txt", "r");
     
     for (i = 0; i < M*N; i++)
     {
        fscanf(stream,"%f", &buf);
      A[i] = buf;
    }

   err = cudaMemcpy(Ad, A, M*N*sizeof(float), cudaMemcpyHostToDevice);
    checkCudaError(err);

    printf("Calling culaDeviceSgetrf\n");
   
   cudaEventCreate(&start_GPU);
   cudaEventCreate(&stop_GPU);
    cudaEventRecord(start_GPU,0);
   
   
    status = culaDeviceSgetrf(M, N, Ad, M, IPIV);

   
   cudaEventRecord(stop_GPU,0);
    cudaEventSynchronize(stop_GPU);
    cudaEventElapsedTime(&gpuTime_GPU,start_GPU,stop_GPU);
    printf("time:  %.4f millseconds\n",gpuTime_GPU);
    cudaEventDestroy(start_GPU);
    cudaEventDestroy(stop_GPU);

   checkStatus(status);



    err = cudaMemcpy(A, Ad, M*N*sizeof(float), cudaMemcpyDeviceToHost);
    checkCudaError(err);
    err = cudaMemcpy(IPIV, IPIVd, N*sizeof(int), cudaMemcpyDeviceToHost);
    checkCudaError(err);

    printf("Shutting down CULA\n");
    culaShutdown();

   
    cudaFree(Ad);
    cudaFree(IPIVd);
    free(A);
    free(IPIV);

    return EXIT_SUCCESS;
}

just_jake
 
Posts: 4
Joined: Wed Sep 29, 2010 9:49 am

Re: GETRF Runtime error <11>

Postby john » Wed Feb 16, 2011 8:29 am

Pass IPIVd if you are using culaDeviceSgetrf. You passed a host pointer which we cannot use in the Device call. We would love to produce a better error message, but it is impossible to differentiate a host pointer from a device pointer until an error occurs.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: GETRF Runtime error <11>

Postby just_jake » Fri Feb 25, 2011 6:35 am

Thank you!
I was inattentive.

I notice that the IPIV vector may be like this 1 3 3 4 3 3 7 when i execute this function on small matrixes...
just_jake
 
Posts: 4
Joined: Wed Sep 29, 2010 9:49 am


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron