What could be wrong ?

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
leaderrealvn
Posts: 1
Joined: Thu Jul 11, 2019 4:52 am

What could be wrong ?

Post by leaderrealvn » Thu Jul 11, 2019 10:30 pm

I wrote one interface to use magma cholesky decomposition, but I am getting all zeros in the output.

Below written is the interface code which takes as an input the dimension m, the matrix a and info

I tried it on a matrix of size 4392 x 4392.
CODE: SELECT ALL

Code: Select all

extern "C" void magma_chol(int m, double* a, int *info)
{


 cuInit( 0 );
    printout_devices( );

    double *h_A, *h_R;
    double *d_A;
    double gpu_perf, cpu_perf;

    TimeStruct start, end;

    /* Matrix size */
    int N=0, n2, lda;
//    int size[10] = {1024,2048,3072,4032,5184,6144,6912,8192,8960,9984};

    cublasStatus status;
    int i, j;


    /* Initialize CUBLAS */
    status = cublasInit();
    if (status != CUBLAS_STATUS_SUCCESS) {
        fprintf (stderr, "!!!! CUBLAS initialization error\n");
    }

    lda = m;
    n2 = m * m;

    /* Allocate host memory for the matrix */


    cudaMallocHost( (void**)&h_R,  n2*sizeof(double) );
    if (h_R == 0) {
        fprintf (stderr, "!!!! host memory allocation error (R)\n");
    }

    status = cublasAlloc(n2, sizeof(double), (void**)&d_A);
    if (status != CUBLAS_STATUS_SUCCESS) {
      fprintf (stderr, "!!!! device memory allocation error (d_A)\n");
    }

    for(j=0;j<n2;j++)
        h_R[j] = a[j];

      start = get_current_time();
    magma_dpotrf("U", &N, h_R, &lda, d_A, info);
      end = get_current_time();

       printf("GPU Processing time: %f (ms) \n", GetTimerValue(start,end));

    cublasFree(h_R);
    cublasFree(d_A);

    /* Shutdown */
    status = cublasShutdown();
    if (status != CUBLAS_STATUS_SUCCESS) {
        fprintf (stderr, "!!!! shutdown error (A)\n");
    }

return;


}
What could be wrong in this code.

Thanks
Last edited by mgates3 on Wed Jul 17, 2019 11:07 am, edited 1 time in total.
Reason: Add [code] ... [/code] formatting

mgates3
Posts: 893
Joined: Fri Jan 06, 2012 2:13 pm

Re: What could be wrong ?

Post by mgates3 » Wed Jul 17, 2019 11:14 am

This looks like portions of the really old MAGMA testers. I suggest starting from the code in the current MAGMA testers (though there's a lot you can strip out of those as being testing code). Please be more explicit about what went wrong. Do you mean the matrix A was all zeros on output? What was it on input? Because it doesn't seem that A should be changed at all by this routine.

I did notice h_R is being deallocated wrong.

-mark

Post Reply