Page 1 of 1

devicePosv Data error <2>

PostPosted: Wed Apr 20, 2011 6:14 am
by alulec
I am using cula R10 with cuda 3.2 in 32-bit win xp . I have some problems about solution of a symmetric system with devicesposv function.

I want to solve a 3x3 symmetric system for trial, however I get an error message:
Data error <2>

I am sending my code sample. I will be grateful for any help.

Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cutil.h>
#include <cuda.h>
#include <culapackdevice.h>
#include <cuda_runtime.h>
#include <cula.h>

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);
}

int main(int argc, char* argv[])
{
   int VectorSize=3;
   int MatSize=9;

   float A[9]={0.8147,0.9134,0.2785,0.9134,0.6324,0.5469,0.2785,0.5469,0.9375};
   float B[3]={1.000,2.000,3.000};

   float *d_A=0,*d_B=0;

   cudaMalloc((void**)&d_A,MatSize*sizeof(float));
   cudaMalloc((void**)&d_B,(VectorSize)*sizeof(float));

   cudaMemcpy(d_A,A,MatSize*sizeof(float),cudaMemcpyHostToDevice);
   cudaMemcpy(d_B,B,VectorSize*sizeof(float),cudaMemcpyHostToDevice);

   char uplo='U';
      
   culaStatus status;
   status = culaInitialize();

   status = culaDeviceSposv(uplo, VectorSize, 1, d_A, VectorSize, d_B, VectorSize);
      
   checkStatus(status);

   culaShutdown();

   cudaMemcpy(B,d_B,VectorSize*sizeof(float),cudaMemcpyDeviceToHost);

   for (int i=0;i<VectorSize;i++)
   {
      printf("%f\n",B[i]);
   }

   cudaFree(d_A);
   cudaFree(d_B);
   
   return 0;
}

Re: devicePosv Data error <2>

PostPosted: Wed Apr 20, 2011 6:24 am
by alulec
My bad the determinant of the matrix was negative, it was solved. However, I wonder if it is possible to use only triangular part of the matrix (Size=N*(N+1)/2)as an input for POSV rather than using full matrix (Size=N*N).

Re: devicePosv Data error <2>

PostPosted: Wed Apr 20, 2011 7:28 am
by kyle
In standard LAPACK, there are "packed data" formats for situations like you have described. However, they are not as high performing as the full data structures due to the irregular layout of the data. That being said, we are working on these formats and they should be included in a future version of CULA.