I am very new to CUDA. I am trying to write a program that draws a mandelbrot fractal. When I set the resolution of the image to 2250x2250 pixels, my monitor goes black and when it turns back on I get a little message telling me that the video card has crashed. When I set the resolution to 2000x2000 pixels this does not happen.
int main(void)
{
//Set various parameters of the image
float lowx = -2, lowy = -2, highx = 2, highy = 2; //bounds on image location in xy-plane
unsigned int xres = 2000, yres = 2000; //resolution of image
//This line comes from the Julia set example in Ch. 4 of CUDA by example by Sanders and Kandrot
dim3 grid(yres,xres);
//Allocate memory
char *bmp = (char *)calloc(xres*yres,sizeof(char));
char *bmpDev;
cudaMalloc((void**)&bmpDev, xres*yres*sizeof(char));
//Call drawing function
evalPoint<<<grid,1>>>(bmpDev,highx,highy,lowx,lowy);
//Save image
cudaMemcpy(bmp,bmpDev,xres*yres*sizeof(char),cudaMemcpyDeviceToHost);
printBMPbw(bmp, xres, yres);
//Deallocate memory
free(bmp);
cudaFree(bmpDev);
}
The above is the function that defines the various parameters of the image and calls the drawing function (evalPoint). Is the grid too big, and if so how do I get around this issue?
Also, when I call nvcc in the cmd window, I also have to type -ccbin “Path to cl.exe” with it. Is there any way around this issue?