45
edits
Changes
→Parallelization
==Parallelization==
After converting a portion of the code to become more parallelized we decided to test the run times of the program at various resolutions. This rendered a picture at a certain quality and at each resolution the run time increased.
===Changing the Render function===
Instead of using regular C++ indexing in the render() function paralleled using Blocks and Thread indexing.
[[File:Render.png]]
===Declaring Device pointer===
We declared a device pointer to the sphere object and allocated memory for device object and lastly copied the data from host object to the device object.
[[File:Htod.png]]
===Setting up the Grid===
We allocated the grid of threads based on the image resolution we set the code to render and divide it by the number of threads per block
[[File:Grid.png]]
===Launching the Kernel===
In the end we launch the kernel to render the image and copy the rendered data from device memory to the host memory.
[[File:block.jpg]]
===Image resolution 512===