Problem with memory allocation when using CULA

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

Problem with memory allocation when using CULA

Postby dzovejn » Mon Jul 26, 2010 7:25 am

I have NVIDIA GeForce 8400 GS with 256MB of memory. I noticed that when I use CULA functions amount of memory that can be allocated is significantly reduced. I used this simple code to find the difference between the amount of memory you can allocate when CULA is initialized and when it is not.

culaInitialize(); // This command is commented when CULA is not initialized

void * p=0;

int N;
printf("Size = ");
scanf("%d", &N);

size_t size =N*1000000;

cudaMalloc((void **) &p, size);

if(p != 0)
{
printf("Memory allocated on GPU.\n");
}
else
{
printf("ERROR: Can not allocate memory on GPU. CUDA: ");
printf(cudaGetErrorString(cudaGetLastError()));
printf("\n");
}

In the first case, when CULA is not initialized, maximum N for which memory allocation is successful is 245.
In the second case, when CULA is initialized, maximum N for which memory allocation is successful is 110.
Does anyone know what may be causing this difference in memory that can be allocated in the first and in the second case?
I have one more question.
I noticed that when I use culaDeviceCgesv() function, CPU usage is 100%. I thought that CPU is idle while CULA functions perform on the GPU. Does CULA use CPU resources during function execution?
dzovejn
 
Posts: 3
Joined: Tue Jul 06, 2010 3:59 pm

Re: Problem with memory allocation when using CULA

Postby kyle » Mon Jul 26, 2010 1:44 pm

The amount of GPU memory can fluctuate depending on the amount of memory being used to draw your desktop, etc. This can easily account for varying amount of free memory.

To answer your second question, CULA uses CPU resources to maximize performance while the GPU is processing.
kyle
Administrator
 
Posts: 301
Joined: Fri Jun 12, 2009 7:47 pm

Re: Problem with memory allocation when using CULA

Postby dzovejn » Mon Jul 26, 2010 2:49 pm

Thank you, Kyle.
I understand that graphics card is used by other processes, but this is a very simple example, where the amount of free memory is significantly reduced when CULA is activated. Namely, one after another, two codes are executed. State of the system in terms of other applications that run in parallel and everything else is the same in both cases. The only difference is that in the first case CULA is initialized, and in the other it is not, and the difference in amount of memory that can be allocated is more than 100MB. The only thing that seems logical to me is that this memory is occupied by CULA.
dzovejn
 
Posts: 3
Joined: Tue Jul 06, 2010 3:59 pm

Re: Problem with memory allocation when using CULA

Postby kyle » Mon Jul 26, 2010 2:53 pm

How do your results compare if you initialize CUDA or CUDA & CUBLAS? These are both initialized implicitly by culaInitialize.
kyle
Administrator
 
Posts: 301
Joined: Fri Jun 12, 2009 7:47 pm

Re: Problem with memory allocation when using CULA

Postby dzovejn » Tue Jul 27, 2010 2:42 am

When only CUBLAS is initialized, it is possible to allocate about 150MB, about 40MB more than when CULA is initialized.
dzovejn
 
Posts: 3
Joined: Tue Jul 06, 2010 3:59 pm


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron