- Code: Select all
magma_int_t N = 4;
int n2 = N*N;
const char *uplo = MagmaLowerStr;
magma_int_t info;
TESTING_MALLOC( h_A, float, n2 );
TESTING_MALLOC( h_C, float, n2 );
TESTING_DEVALLOC( d_A, float, n2);
/*Populate the matrix*/
for (i =0; i < N; i++){
for (j = 0; j < N; j++){
h_A[i*N + j]=(float)(i*N+j);
}
}
/* Transfering data to the GPU*/
magma_ssetmatrix( N, N, h_A, N, d_A, N );
/* Calculate Matrix Inverse */
magma_spotrf_gpu(uplo[0], N, d_A, N, &info);
magma_spotri_gpu(uplo[0], N, d_A, N, &info);
if (info != 0)
printf("Argument %d of magma_spotri had an illegal value.\n", (int) -info);
/* Get results */
magma_sgetmatrix( N, N, d_A, N, h_C, N );
/* Verify results */
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
printf("h_C[%d] = %f \n", i*N+j, h_C[i*N+j]);
}
}
What am I doing wrong? I've followed the testing example but I don't really get the difference with my code. Any ideas?
