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
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