Hi alls!
I have a problem with a CUDA code. I don´t know the reason that this code is not correcto because it doesn´t do the memory allocation.
cudaMalloc((void**)&leftHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf(“\n\nMemory Allocation Error”);
//getchar();
exit(0);
}
cudaMalloc((void**)&rightHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf(“\n\nMemory Allocation Error”);
//getchar();
exit(0);
}
When i execute the progam always it enters in ‘if’ so it wasn´t be able to do the memory allocation. Can you help me?
Thanks to advance!
gonnet
April 15, 2010, 10:00am
2
Hi alls!
I have a problem with a CUDA code. I don´t know the reason that this code is not correcto because it doesn´t do the memory allocation.
cudaMalloc((void**)&leftHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf("\n\nMemory Allocation Error");
//getchar();
exit(0);
}
cudaMalloc((void**)&rightHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf("\n\nMemory Allocation Error");
//getchar();
exit(0);
}
When i execute the progam always it enters in ‘if’ so it wasn´t be able to do the memory allocation. Can you help me?
Thanks to advance!
cudaErrorMemoryAllocation is a constant: you should do something like:
cudaError_t cures = cudaMalloc(…)
if (cures == cudaErrorMemoryAllocation)
{
…
}
Hope that helps
Cédric
gonnet
April 15, 2010, 10:00am
3
Hi alls!
I have a problem with a CUDA code. I don´t know the reason that this code is not correcto because it doesn´t do the memory allocation.
cudaMalloc((void**)&leftHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf("\n\nMemory Allocation Error");
//getchar();
exit(0);
}
cudaMalloc((void**)&rightHost, g_w*g_h);
if(cudaErrorMemoryAllocation){
printf("\n\nMemory Allocation Error");
//getchar();
exit(0);
}
When i execute the progam always it enters in ‘if’ so it wasn´t be able to do the memory allocation. Can you help me?
Thanks to advance!
cudaErrorMemoryAllocation is a constant: you should do something like:
cudaError_t cures = cudaMalloc(…)
if (cures == cudaErrorMemoryAllocation)
{
…
}
Hope that helps
Cédric
thanks a lot, your reply it´s ok, and other question, sorry if i am very busy but my intention is only to learn. When i execute the next code appears and execution, i think that its happens because a memory cause, but i can´t see that. What are your opinion?
memcpy(leftImg, LeftImg->imageData, ImageWidthImageHeight);
memcpy(rightImg,RightImg->imageData, ImageWidth ImageHeight);
Thanks!
thanks a lot, your reply it´s ok, and other question, sorry if i am very busy but my intention is only to learn. When i execute the next code appears and execution, i think that its happens because a memory cause, but i can´t see that. What are your opinion?
memcpy(leftImg, LeftImg->imageData, ImageWidthImageHeight);
memcpy(rightImg,RightImg->imageData, ImageWidth ImageHeight);
Thanks!