
104 High Performance Programming for Soft Computing
unsigned int hBlockCounter = 0;
checkCudaErrors(cudaMemcpyToSymbol(blockCount
er, &hBlockCounter, sizeof(unsigned int), 0,
cudaMemcpyHostToDevice));
int numWorkerBlocks = numSMs;
Fig. 4.7 Defi nition of variables that keep track of the grid block position while calculating
the fractal.
Once all the parameters were declared and specifi ed, we run the main
CUDA thread called Mandelbrot0, see Fig. 4.8, by utilizing the correct
syntaxes containing the number of CUDA
blocks, in which the function will
run and the number of threads per block in the style of functionName<return
value><<<Number of Blocks, ...