Monday April 27, 2015
Your challenge is to parallelize part of an existing serial/OpenMP code simulating a forest fire to make use of the CUDA platform for running in parallel on a GPGPU.
You are given as starter code the "CUDA Fire starter zip file" below. This code is for the simulation of a forest fire - the trees are arranged in a 2D grid; one random tree is initially lit on fire.

The code already makes use of OpenMP, but this is a red herring. Your challenge is to utilize CUDA to parallelize the advanceBurningTrees function so it can be run on a GPGPU. You should change this function to be a CUDA device kernel, and use cudaMemcpy to copy the relevant forest arrays back and forth from the GPGPU.

You should use the macro FOREST_ROW_COUNT as the block size when you run the kernel.

Don't forget to cudaMalloc and cudaFree your device memory!

If a solution is run on a host machine with a GPGPU, the advanceBurningTrees kernel should verifiably run on the GPGPU, but the output should be the same as the serial version (taking the programmed randomness into account).
Show solution
Challenge Resources:
©1994-2024   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |   feedback  |   facebook   |   twitter   |   rss   |   youtube   |   XSEDE Code of Conduct   |   Not Logged In. Login