culaInitilize() out exception in Visual Studio.

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

culaInitilize() out exception in Visual Studio.

Postby hniihara » Thu Oct 15, 2009 7:35 pm

culaInitilize() returnes culaNoError.
but VS8 catch a exception cudaErr.
Is this normal?
Is this specification?

I use "CULA Examples "device" project".
(win64 & VS8)

and add code.
culaDeviceSgesvd out too many same exseptions.
why?

--- add ---
culaDeviceFloat *pD, *pU, *pS, *pV;
int buffSize = M * M * sizeof(culaDeviceFloat);
err = cudaMalloc((void**)&pD, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pU, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pS, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pV, buffSize); checkCudaError(err);

err = cudaMemset( pD, 0, buffSize ); checkCudaError(err);
err = cudaMemcpy( pD, A, buffSize, cudaMemcpyHostToDevice );

printf("Calling SGESVD\n");
status = culaDeviceSgesvd( 'A', 'A', M, N,
(culaDeviceFloat*)pD, M,
(culaDeviceFloat*)pS,
(culaDeviceFloat*)pU, N,
(culaDeviceFloat*)pV, N );
checkStatus(status);

-----

Regards
hniihara
CULA Premium
 
Posts: 2
Joined: Wed Aug 19, 2009 12:45 am

Re:culaInitilize() out exception in Visual Studio.

Postby dan » Fri Oct 16, 2009 6:00 am

Hi hniihara,

CULA uses exceptions internally, but it is not possible for them to propagate across CULA's API boundary. Visual Studio does keep a record in its output window whenever a module you are using throws an exception. This normal behavior is likely what you're reporting.

What is important to consider is only the return code than an API function reports; the fact that an exception is used internally is only a detail in getting that return code to you.

To debug your particular problem, we'll need some more details. I'm not sure what you mean by "culaDeviceSgesvd out too many same exseptions", can you explain this more? What are 'M' and 'N' in your example?

Dan
dan
Administrator
 
Posts: 61
Joined: Thu Jul 23, 2009 2:29 pm

Re:culaInitilize() out exception in Visual Studio.

Postby hniihara » Tue Oct 20, 2009 1:52 am

Thanks for the answer. :laugh:

and my program. (based on "geqrf_device.c")

----
int main(int argc, char** argv)
{
#ifdef NDEBUG
int M = 8192;
#else
int M = 1024;
#endif
int N = M;

cudaError_t err;
culaStatus status;

// point to host memory
float* A = NULL;
float* TAU = NULL;

// point to device memory
float* Ad = NULL;
float* TAUd = NULL;

printf("Allocating Matrices\n");
A = (float*)malloc(M*N*sizeof(float));
TAU = (float*)malloc(N*sizeof(float));
if(!A || !TAU)
exit(EXIT_FAILURE);

err = cudaMalloc((void**)&Ad, M*N*sizeof(float));
checkCudaError(err);

err = cudaMalloc((void**)&TAUd, N*sizeof(float));
checkCudaError(err);

printf("Initializing CULA\n");
status = culaInitialize();
checkStatus(status);

memset(A, 0, M*N*sizeof(float));
err = cudaMemcpy(Ad, A, M*N*sizeof(float), cudaMemcpyHostToDevice);
checkCudaError(err);

printf("Calling SGEQRF\n");
status = culaDeviceSgeqrf(M, N, Ad, M, TAUd);
checkStatus(status);

err = cudaMemcpy(A, Ad, M*N*sizeof(float), cudaMemcpyDeviceToHost);
checkCudaError(err);
err = cudaMemcpy(TAU, TAUd, N*sizeof(float), cudaMemcpyDeviceToHost);
checkCudaError(err);

// add hniihara
{
culaDeviceFloat *pD, *pU, *pS, *pV;
int buffSize = M * N * sizeof(culaDeviceFloat);
err = cudaMalloc((void**)&pD, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pU, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pS, buffSize); checkCudaError(err);
err = cudaMalloc((void**)&pV, buffSize); checkCudaError(err);

err = cudaMemcpy( pD, A, buffSize, cudaMemcpyHostToDevice );

printf("Calling SGESVD\n");
status = culaDeviceSgesvd( 'A', 'A', M, N,
(culaDeviceFloat*)pD, M,
(culaDeviceFloat*)pS,
(culaDeviceFloat*)pU, N,
(culaDeviceFloat*)pV, N );
checkStatus(status);
}

printf("Shutting down CULA\n");
culaShutdown();

cudaFree(Ad);
cudaFree(TAUd);
free(A);
free(TAU);

return EXIT_SUCCESS;
}

----


Regards.
hniihara
CULA Premium
 
Posts: 2
Joined: Wed Aug 19, 2009 12:45 am


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron