Memory Access Error

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
tomac
Posts: 7
Joined: Wed Jan 26, 2011 5:06 am

Memory Access Error

Post by tomac » Tue Feb 22, 2011 8:44 am

Hello, i am trying to solve by LU (sgetrs_gpu)
so i have to factorize first with (sgetrf_gpu)

I think everything runs fine until calling

Code: Select all

cublasStrsm(MagmaLeft, MagmaUpper, MagmaNoTrans, MagmaNonUnit, n, nrhs, c_one, dA, ldda, dB, lddb );
in the magma_sgetrs_gpu method

I am a little bit confused, probably the mistake is on my side, so i ask the pros.
here is the funktion. A is an NxN Matrix, size is N, B is an Vector with dim N:

Code: Select all

float* LU(float* h_A, int size, float* h_B){
 
TESTING_CUDA_INIT();

    float *h_R,*h_X;
    float *d_A,*d_B;

    magma_int_t     *ipiv;

    /* Matrix size */
    magma_int_t M =size, N = size, lda =size, ldda = size, lddb = size;

    magma_int_t info, min_mn;

    min_mn = min(M, N);

    /* Allocate host memory for the matrix */
    TESTING_MALLOC(ipiv, magma_int_t, min_mn);
    TESTING_MALLOC(    h_A, float, M * N     );
    TESTING_HOSTALLOC( h_R, float, M * N    );
    TESTING_MALLOC( h_B, float, lda*1 );
    TESTING_MALLOC( h_X, float, lda*1 );
    TESTING_DEVALLOC(  d_A, float, ldda*N );
    TESTING_DEVALLOC( d_B, float, lddb*1 );

    h_R=h_A;

        cublasSetMatrix( M, N, sizeof(float), h_R, lda, d_A, ldda);
	cublasSetMatrix( N, 1, sizeof( float ), h_B, N, d_B, lddb );
      
         magma_sgetrf_gpu( M, N, d_A, ldda, ipiv, &info);	
	 magma_sgetrs_gpu('N', M, 1, d_A, ldda, ipiv, h_B, ldda, &info);	

 //cublasGetMatrix( M, N, sizeof(float), d_A, ldda, h_A, lda);
        cublasGetMatrix( N, 1, sizeof( float ), d_B, ldda, h_X, lda );

    TESTING_CUDA_FINALIZE();

return h_X ;
}
thanks Tomac

tomac
Posts: 7
Joined: Wed Jan 26, 2011 5:06 am

Re: Memory Access Error

Post by tomac » Thu Mar 10, 2011 5:25 am

Hey there,
I am still interested in how a running testing_sgetrs_gpu would look like.
Cant find an example to this funktion.

best regards
Tomac

mateo70
Posts: 41
Joined: Tue Mar 08, 2011 12:38 pm

Re: Memory Access Error

Post by mateo70 » Tue Mar 15, 2011 5:14 pm

Hi,

what is exactly your problem ? Do you have a segfault ? do you have a problem of precision in the result ? What is the size ? What is your configuration ?
The only thing I see, is that you need to have ldda and lddb multiple of 32 for LU and at one point your are using ldda instead of lddb but it doesn't matter since they are the same.

Mathieu

tomac
Posts: 7
Joined: Wed Jan 26, 2011 5:06 am

Re: Memory Access Error

Post by tomac » Tue Apr 12, 2011 5:22 am

i think error was on my side, wrong Matrix :-(
Now i try to test it with the given test file testing_sgetrf_gpu by adding the line

Code: Select all

magma_sgetrs_gpu('N', N, 1, d_A, ldda, ipiv, h_R, ldda, &info)
but same as before, seg fault...


Edit: I´m so stupid... using h_R instead of d_R

Post Reply